Here is the November 2012 version of my SQL Server 2012 Diagnostic Information Queries, with some minor tweaks and improvements to a couple of the existing queries. I want to thank Mike Fal (blog/Twitter) who made a very useful suggestion for Query #36.
To go with this new version is an updated, blank SQL Server 2012 results spreadsheet, where the tabs in the spreadsheet are labeled and in the same order as the queries. The idea is that you can run these queries one by one, click on the top left square of the results grid, and then right-click and select “Copy with Headers” to select and copy the results of the query and then paste them into the matching tab of the results spreadsheet.
Many of these queries only work on SQL Server 2012, although some will work on older versions of SQL Server. If you are using an older version of SQL Server, you should use the version of my diagnostic queries for that version of SQL Server.
As always, I welcome any feedback you may have about these queries.
Glenn, thanks for this months new rendition. I’m downloading and will actively be using these in my 2012 environment. As I run across anything I’ll ping you back for feedback. Again many thanks for keeping these so up to date. I have found them very useful and have named it my CheklistOnSteroids locally. Take care
Pingback: SQL Server – Diagnostic Information Queries (2005/2008/2012) « Alex Souza
Glenn, thanks for this incredibly valuable tool. I’ve been using your diagnostic queries for a long time and I always learn something new from your updates.
Let me propose a tweak to your query #25: since we’re running on SQL Server 2012, we could take advantage of the improvements in the OVER clause and calculate running totals in a more efficient manner:
,CAST(wait_time_ms / 1000. AS DECIMAL(12, 2)) AS wait_time_s
,CAST(100. * wait_time_ms / SUM(wait_time_ms) OVER () AS decimal(12,2)) AS pct
,ROW_NUMBER() OVER (
ORDER BY wait_time_ms DESC
) AS rn
FROM sys.dm_os_wait_stats WITH (NOLOCK)
WHERE wait_type NOT IN (
Running_Waits AS (
,SUM(pct) OVER(ORDER BY pct DESC ROWS UNBOUNDED PRECEDING) AS running_pct
FROM Waits AS W1
WHERE running_pct – pct < 99
ORDER BY running_pct