Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Identify Allocation Contention in TEMPDB

By Brad McGehee,


When this script runs, it identifies resource allocation contention in the PFS, GAM, and SGAM pages in tempdb. The results of this script include the SessionID of the connections causing the contention, the Wait_Time_In_Milliseconds shows how long a latch has been held on a PFS, GAM or SGAM page, and the Type_of_Allocation shows you the type of allocation page that is experiencing the allocation contention. PFS pages generally return 2:1:1, GAM pages generally return 2:1:2, and SGAM pages generally return 2:1:3.

The first number indicates the databaseid, which is 2, as tempdb is always assigned a databaseid of 2. The second number indicates the file number. So a 1 indicates the first file, a 2, the second file, and so on. The third number indicates the page number in the file that represents the type of page. Number 1 represents a PFS page, number 2 represents a GAM page, and number 3 represents a SGAM page. If a PFS, GAM or SGAM is experiencing a high number of latches, especially latches that are held very; this is a strong indicator that the tempdb database needs to be divided into multiple files. By creating multiple files, additional PFS, GAM, and SGAM pages are created, which can reduce contention.

The results of this script are for only the instant that the script is run. Because of this, you may have to run this script multiple times in order to capture what is going on inside your tempdb. If you don't get back any results after multiple tries on your servers, then most likely you don't have a tempdb resource allocation contention problem.On the other hand, be sure to run this script throughout the busy times of the day in order to identify transient problems.

Be sure to research this topic in-depth before creating multiple tempdb files, as this may or may not be the best solution for all SQL Server instances.

Total article views: 2737 | Views in the last 30 days: 34
 
Related Articles
BLOG

Breaking Down TempDB Contention (part 2)

Breaking Down TempDB Contention (part 2) Tempdb Contention via Idera Diagnostic Manager I wrote ...

BLOG

Breaking Down TempDB Contention

Breaking Down TempDB Contention  What is tempDB contention? From the outside looking in, tempDB con...

BLOG

Tempdb Contention That Can’t be Soothed

Tempdb Contention That Can’t be Soothed By Adding Files Tempdb Contention via Idera diagnostic ma...

BLOG

SQL Server – Script to Configure TempDB Files per Number of Logical Processors

In order to reduce Tempdb contention one of  the best practices is to maintain multiple sized Tempdb...

FORUM

allocation page contention in tempDB?

Hi, In my production database have 1:1 data & log file..as per this script no result is dispaly, ...

Tags
tempdb    
 
Contribute