SQL Server Diagnostic Information Queries for June 2020


These are my SQL Server Diagnostic Information Queries for June 2020, aka my DMV Diagnostic Queries. They allow you to get a very comprehensive view of the configuration and performance of your SQL Server instance in a short amount of time. There are separate versions of these T-SQL queries for SQL Server 2005 through SQL Server 2019. I also have separate versions for SQL Managed Instance and Azure SQL Database. My diagnostic queries have been used by many people around the world since 2009. I make regular improvements to these queries each month.

SQL Server Diagnostic Information Queries for June 2020
SQL Server Diagnostic Information Queries for June 2020

Monthly Improvements

This month, I have made more minor improvements, especially for SQL Server 2019. Many of the changes are documentation related, with updated and improved links. BTW, I often make additional minor updates to the queries periodically during the month, so if you are in doubt, downloading the latest version is always a good idea. They are always available from my Resources page.

Rather than having a separate blog post for each version, I have just put the links for all eleven major versions in this post. There are two separate links for each version. The first one on the top left is the actual diagnostic query script, and the one below on the right is the matching blank results spreadsheet, with labeled tabs that correspond to each query in the set.

Here are links to the latest versions of these queries for SQL Managed Instance, Azure SQL Database, and all available versions of SQL Server:

Azure Diagnostic Queries

SQL Server Diagnostic Queries

Legacy SQL Server Diagnostic Queries

Usage Instructions

The basic instructions for manually running these queries is that you should run each query in the set, one at a time. You should read the directions for each query and my comments on how to interpret the results. It is not a good idea to simply run the entire batch in one shot. This is especially true the first time you run these queries on a particular server. Some of these queries can take some time to run, depending on your workload and hardware.

It is very useful to run each query, look at the results and think about the emerging picture of what is happening on your server. I have quite a few comments and links in the script on how to interpret the results after each query.

Saving the Results

After running each query, you click on the top left square of the results grid in SQL Server Management Studio (SSMS) to select all of the results. Next, you right-click and select “Copy with Headers” to copy the results, including the column headers to the Windows clipboard. Finally, you paste the results into the matching tab in the blank results spreadsheet.

About half of the queries are instance specific and about half are database specific. Because of this, make sure you are connected to a database that you are concerned about! Make sure you are not connected to the master system database. Running the database-specific queries while being connected to the master database is a very common mistake. As a result, I often see people make this mistake when they run these queries.


Note: These queries are stored on Dropbox. I occasionally hear that the links to the queries and blank results spreadsheets don’t work. This is usually because Dropbox is blocked where someone is trying to connect. I am not planning on moving these to Github any time soon, but I could change my mind.

Unfortunately, I sometimes get reports that some of the queries simply don’t work. This usually happens with an incorrect version of the script for the version of SQL Server. Sometimes, it turns out to be an issue where people have some of their user databases in 80 compatibility mode. This will break many DMV queries.

It is important that you are running the script that matches the version of SQL Server that you are running. There is an initial query in each script that confirms that you are using the correct version of the script. If you are not using the correct version of these queries, you will have problems.

Checking Spectre/Meltdown Status

In addition, I have a T-SQL script to check whether an instance of SQL Server has been patched to mitigate against the Spectre/Meltdown CPU vulnerability. This query works for SQL Server 2008 through SQL Server 2017, for on-premises and cloud-based VM (IaaS) usage. SQL Server 2019 has this fix in all builds, so you don’t have to check that. You can get the query for this here.

Please let me know what you think of these queries, and whether you have any suggestions for improvements. Thanks!

Additional Resources

If you want to understand how to better interpret these queries, you should listen to my six related Pluralsight courses. These include, Azure SQL Database: Diagnosing Performance Issues with DMVsSQL Server 2017: Diagnosing Performance Issues with DMVsSQL Server 2017: Diagnosing Configuration Issues with DMVs. They also include SQL Server 2014 DMV Diagnostic Queries – Part 1,  SQL Server 2014 DMV Diagnostic Queries – Part 2, and SQL Server 2014 DMV Diagnostic Queries – Part 3. All six of these courses are pretty short and to the point, at 91, 164, 106, 67, 77, and 68 minutes respectively. Listening to these six courses is really the best way to thank me for maintaining and improving these scripts…

1 thought on “SQL Server Diagnostic Information Queries for June 2020

Please tell me what you think

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close