'temp tables faster than variable tables big query

I have always been using With tabes when working with long queries but I recently tried the create temp table and the execution was so much faster. The one with With tables (variable names) got an error as too heavy after 12 minutes and the one with create or replace temp table finished in less than 2 minutes. Why is that the case?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source