简体   繁体   中英

update speed temp table versus table variable

Update of temp table is slowed down by logging on update. Will the same logging happen on a table variable ? Is there a way to prevent this logging to speed up updates on a large table. For exemple in an ETL, you dont need rollback capability.

Trx logs are not applied to table variables, and also no statistics generated for table variables. So it depends on how you use the table variables whether they perform better or not than temp tables. And NO, you can't disable trx logging for tables or temp tables in SQL server. You can change database option to BULK Logged for better logging performance, however it will affect all the tables in the db and it has some implications for the db recovery. Unless the db is purely for ETL, it is not recommended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM