Thursday, January 27, 2011

SQL Server: Table Variables Are Created In Memory Or In Tempdb


In response to the earlier post How to Create Different Type of Tables a reader asked a question that

 

“Is it true that temp table are created in Tempdb but Table variables are created only in memory and because of this, table variables are more efficient as compared to temp tables”

 

My answer is that, it’s just a misconception that table variables are created in memory and truth is that both temporary tables and table variables are created in tempdb. Pinal Dave and Ken Simmons already proved it so well. So I will suggest reading these posts for more clarifications.

SQL SERVER – Difference TempTable and Table Variable – TempTable in Memory a Myth By Pinal Dave

Yes, Table Variables and Temp Tables both use the tempdb By Ken Simmons

No comments:

Post a Comment

All suggestions are welcome