dcsimg
 

How to Resize tempdb

Thursday Aug 2nd 2018 by Greg Larsen

When you are setting up a new SQL Server machine you need to determine how big you should make tempdb. To make sure you size tempdb appropriately you should monitor the tempdb space usage. If there are autogrowth events occurring after you have recycled SQL Server than you might want to increase the size of your tempdb data files. If tempdb never uses most of the tempdb space, then you might want to consider decreasing the size of tempdb.

When you are setting up a new SQL Server machine you need to determine how big you should make tempdb.  Not an easy task to get it right out of the box.  If you make tempdb too small, then the tempdb data or log file will have autogrowth events, as tempdb needs more space. Every time tempdb grows SQL Server will need to pause activity for a short period of time while the system grows the tempdb files.  This means your application transactions will have to wait while these autogrow events occur.  On the flip side if your tempdb database is oversized then you are just wasting disk space. 

To make sure you size tempdb appropriately you should monitor the tempdb space usage.  If there are autogrowth events occurring after you have recycled SQL Server than you might want to increase the size of your tempdb data files.  If tempdb never uses most of the tempdb space, then you might want to consider decreasing the size of tempdb. 

In order to resize tempdb you can use the ALTER DATABASE command.  By using the ALTER DATABASE command, you can set the initial size of the tempdb data and/or log files.  Below is an example where I changed the initial size of my tempdb DATA and LOG file:

ALTER DATABASE tempdb
  MODIFY FILE (Name=tempdb_data, filesize = 100MB),   
  MODIFY FILE (NAME=tempdb_log , filesize = 20MB);

Keep in mind the new sizes specified do not take effect until you recycle SQL Server.

See all articles by Greg Larsen

Home
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved