SQL Server – Capture the Wait Stats to table for analysis

We can find the SQL Server wait stats by using

DBCC SQLPERF (waitstats)
01_Capture the Wait Stats to table for analysis

Capture the Wait Stats to table for analysis

 

Now we need to capture all these wait stats to table for analysis

--Create a temp table for waitstats

CREATE TABLE #waitstats
(
	wait_type VARCHAR(500),
	Request REAL,
	wait_time REAL,
	signal_wait_time REAL
)

-- Insert the waitstats to table 

INSERT INTO #waitstats EXEC('DBCC SQLPERF(waitstats)')

--Now you can analysis waitstats 

SELECT * FROM #waitstats

 

02_Capture the Wait Stats to table for analysis

Capture the Wait Stats to table for analysis

Hope this will help you to analyze the wait stats.