Temp tables are similar to tables, but when created, they are stored in tempdb, which means that the optimizer can create statistics on them, and table variables are like variables and there are no statistics on them. Usually, when comparing tmp tables and table variables, temp tables come first. The reason is that the query optimizer sometimes creates bad plans for table vars. This can be seen when there is a lot of data. The most I can do is that table variables are more likely to cause unpredictable execution plans compared to plans created for temporary tables. Temp tables, on the other hand, will cause a big recompilation.
source share