CTE (Common Table Expression) versus Temp tables or table variables, what happens faster?

CTE(Common Table Expression) vs Temp tablesor Table variables, which is faster?

+3
source share
3 answers

We got a 50% increase in speed moving in the CTE in one particular case, so it’s worth the time, but any performance improvements should be marked with a bench so that you can compare one against the other.

PS: we wrote more than one request with a CTE in it before we got the one we are currently using.

+3
source

As I said in my comment: IT DEPENDS!

, ( ? ?) .

, , :

  • CTE " ", ; , SQL Server

  • Temp : (create table #temp) , (create table ##temp); , . ,

  • , - ! A ROLLBACK , ....

+20

http://royalarun.blogspot.in/2013/10/difference-between-cte-and-temp-table.html

CTE Temp Table SQL Server

  • Temp Tempdb. , , . Local temp Global Temp Table, Temp SQL Server ( ), . SQL Server ( ). SQL Server, SQL Server. .

  • CTE - Common table Expression - , . . , Tempdb. - CTE.

  • Variable . , . Tempdb, . , PRIMARY KEY UNIQUE . , .

+3

All Articles