tempdb growth

As its names implies, the tempdb database contains temporary data that are created during SQL Server operations.

Such data 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.

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

Well, there is more than one option for doing this.

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

Labels: , ,