tempdb growth

tempdb growth

tempdb growth

As its names implies, the tempdb database contains temporary data that is created during SQL Server operations, therefore, the tempdb growth is one significant issue that needs to be properly managed in SQL Server.

Temporary data stored in tempdb system database

Temporary data stored in temdb may include: temporary user objects (i.e. temporary tables, cursors), row versions (i.e. those that come up from online index operations), and other internal objects that are created by SQL Server Database Engine.

The tempdb is global on a SQL Server Instance, that is available to all the users/databases on a SQL Server Instance, so in the cases where an instance might contain a large number of databases resulting to a large number of operations which use temporary data, this might have as an effect the tempdb size to increase rapidly.

 

How you can shrink tempdb?

So, how can you shrink the tempdb database and limit its size?

Even though tempdb is fully managed by SQL Server’s Database Engine, there are some things you can try to shrink it.

The following KB article describes three different methods for shrinking tempdb.

In summary, these are:

Method 1
Altering the tempdb file size with the “ALTER DATABASE [tableName] MODIFY FILE” command

Method 2
Using the “dbcc shrinkdatabase” command

Method 3
Using the “dbcc shrinkfile” command

 

Note: Generally, it is not recommended to try and manually limit the size of tempdb. Instead, you need to make a proper disk capacity planning and know your databases and any heavy batch operations they may run that use tempdb.

 

Read Also

 

Did you find this article useful and interesting? Feel free to leave your comment!

If you enjoy my SQL Server administration tips and articles, I have something special just for you. It is one of my eBooks and it is called “Administering SQL Server“. Check it out!

Subscribe to our newsletter and stay up to date with our latest articles on SQL Server and related technologies!

Check out our latest software releases! All our software tools have 30-day Trial Versions which are free to download.

 

Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)

Loading...

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

© SQLNetHub

Artemakis Artemiou
Artemakis Artemiou is a Senior SQL Server and Software Architect, Author, and a 9 Times Microsoft Data Platform MVP (2009-2018). He has over 15 years of experience in the IT industry in various roles. Artemakis is the founder of SQLNetHub and TechHowTos.com. Artemakis is the creator of the well-known software tools Snippets Generator and DBA Security Advisor. Also, he is the author of many eBooks on SQL Server. Artemakis currently serves as the President of the Cyprus .NET User Group (CDNUG) and the International .NET Association Country Leader for Cyprus (INETA). Artemakis's official website can be found at aartemiou.com.