Difference between CTE, Temp Table and Table Variable in MSSQL

All are used for temporary storage of data.

Is there a difference in performance ( time complexity and space complexity ) for these three types of temporary table?

Performance should depend on whether the result is stored on disk or in memory.

I searched, but did not get satisfactory answers.

+4
source share
1 answer

A fairly broad topic to cover all the problems. Here are a few high-level differences that would give you more ideas for exploring this.

CTE . CTE ( CTE ).

, , SQL- , . , tempdb, , . SQL- (, ), , .

: https://www.brentozar.com/archive/2014/06/temp-tables-table-variables-memory-optimized-table-variables/

0

Source: https://habr.com/ru/post/1666617/


All Articles