dcsimg
Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
SQL Scripts & Samples
Tips
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:
DatabaseDaily  

By submitting your information, you agree that databasejournal.com may send you databasejournal offers via email, phone and text message, as well as email offers about other products and services that databasejournal believes may be of interest to you. databasejournal will process your information in accordance with the Quinstreet Privacy Policy.

News Via RSS Feed


Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

Database User and Programming Tips

Posted August 2, 2018

WEBINAR:
On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


How to Resize tempdb

By Greg Larsen

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



Database User and Programming Tips Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.