tempdb write optimization

Temporary databases are not recoverable because Adaptive Server drops and re-creates them when it reboots. Adaptive Server takes advantage of this by delaying write of data or log buffers.

In normal, non-temporary databases, if you use a command such as select that is not logged, Adaptive Server saves the data to disk for recovery purposes.

With version 12.5.0.3 and later, Adaptive Server does not do this for temporary databases. This means that if you use a command such as the following select into statement with a temporary database, Adaptive Server does not force the write of data buffers to the disk:

select * into tempdb..temp_table from foo

In addition, commands such as insert, update, and delete with temporary databases do not force Adaptive Server to write a log at the end of the commit operation. For example, the following insert into command results in fewer context switches and a lighter load on the log or data devices, and higher throughput:

insert into tempdb..temp_table select * from foo