Sample Header Ad - 728x90

Do temp tables cause Recompilations in SQL Server?

1 vote
2 answers
295 views
we have a database on SQL Server 2019 with compatibility set to 110 (SQL Server 2012). We have a stored procedure that is being recompiled frequently, and I noticed we are using many temp tables. We create a temp table, insert data, and then add an index on it for further queries. I suspect this might be causing the recompilations. Do temp tables trigger recompiles, and if so, under what conditions? Thank you!
Asked by lifeisajourney (751 rep)
Oct 16, 2024, 06:35 PM
Last activity: Mar 22, 2025, 06:59 PM