[Quick Tip] When is TempDB Used?

When is TempDB Used? That’s a very good question!

In this SQL Server Administration quick tip, we will be discussing about, when the TempDB SQL Server system database is used.


About the TempDB System Database in SQL Server

TempDB is one of the system databases of SQL Server. As its name implies, it is being used for holding temporary stuff. However, after different discussions I had with a lot of people, I believe that many people have a misconception regarding when TempDB is actually used in SQL Server, and consequently, they might not be taking into full consideration the performance-related factors and guidelines about this special database.

So the question remains: When is TempDB Used? 


TempDB is not only used for temporary tables

TempDB is not just used for storing temporary tables. Besides from storing user objects (global/local temporary tables and indexes, temporary stored procedures, table variables, Tables returned in table-valued functions, or cursors), the TempDB database is also used for storing internal objects which are created by the Database Engine such as:
– Work tables that are used for storing intermediate results.
– Work files for hash join or hash aggregate operations.

– Intermmediate sort results of operations such as index rebuild, etc.

Moreover, tempdb is used to store version stores, that is collection of data pages that contain data which is used by operations that utilize row versioning.

For all the above reasons, you need to take into consideration the performance optimization guidelines regarding the TempDB database, as it plays a significant role to the overall performance of your SQL Server instance.

I have written another more comprehensive article in the past, dedicated to the TempDB system database in SQL Server. Feel free to check it here.

Moreover, feel free to check out my eBook “Tuning SQL Server” where I dedicated a full chapter on the TempDB database.



Strengthen your SQL Server Administration Skills – Enroll to our Online Course!

Check our online course on Udemy titled “Essential SQL Server Administration Tips(special limited-time discount included in link).

Via the course, you will learn essential hands-on SQL Server Administration tips on SQL Server maintenance, security, performance, integration, error handling and more. Many live demonstrations and downloadable resources included!

Essential SQL Server Administration Tips - Online Course with Live Demonstrations and Hands-on Guides
(Lifetime Access/ Live Demos / Downloadable Resources and more!)

Learn More


Featured Online Courses:


Read Also:


Check our other related SQL Server Administration articles.

Subscribe to our newsletter and stay up to date!

Check out our latest software releases!

Check out our eBooks!


Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)


Reference: SQLNetHub (https://www.sqlnethub.com)

© SQLNetHub