SQL Server Diagnostic Information Queries for January 2018

This month, there are more minor updates to the all of the versions of the queries, primarily in the comments and documentation. There are also links for the Spectre/Meltdown hotfixes for SQL Server 2008 SP4 and SQL Server 2008 R2 SP3.

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.

Rather than having a separate blog post for each version, I have just put the links for all eight major versions in this single 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 Azure SQL Database, SQL Server 2017, 2016, and 2014:

Azure SQL Database Diagnostic Information Queries

Azure SQL Database Blank Results Spreadsheet

SQL Server 2017 Diagnostic Information Queries

SQL Server 2017 Blank Results Spreadsheet

SQL Server 2016 Diagnostic Information Queries

SQL Server 2016 Blank Results Spreadsheet

SQL Server 2014 Diagnostic Information Queries

SQL Server 2014 Blank Results Spreadsheet

Here are links to the most recent versions of these scripts for SQL Server 2012 and older:

Since SQL Server 2012 and older are out of Mainstream support from Microsoft (and because fewer of my customers are using these old versions of SQL Server), I am not going to be updating the scripts for these older versions of SQL Server every single month going forward.  I started this policy a while ago, and so far, I have not heard any complaints.

SQL Server 2012 Diagnostic Information Queries

SQL Server 2012 Blank Results Spreadsheet

SQL Server 2008 R2 Diagnostic Information Queries

SQL Server 2008 R2 Blank Results Spreadsheet

SQL Server 2008 Diagnostic Information Queries

SQL Server 2008 Blank Results Spreadsheet

SQL Server 2005 Diagnostic Information Queries

SQL Server 2005 Blank Results Spreadsheet

The basic instructions for using these queries is that you should run each query in the set, one at a time (after reading the directions for that query). It is not really a good idea to simply run the entire batch in one shot, especially the first time you run these queries on a particular server, since some of these queries can take some time to run, depending on your workload and hardware. I also think it is very helpful to run each query, look at the results (and my comments on how to interpret the results) and think about the emerging picture of what is happening on your server as you go through the complete set. I have quite a few comments and links in the script on how to interpret the results after each query.

After running each query, you need to click on the top left square of the results grid in SQL Server Management Studio (SSMS) to select all of the results, and then right-click and select “Copy with Headers” to copy all of the results, including the column headers to the Windows clipboard. Then 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, so you will want to make sure you are connected to a database that you are concerned about instead of the master system database. Running the database-specific queries while being connected to the master database is a very common mistake that I see people making when they run these queries.

Note: These queries are stored on Dropbox. I occasionally get reports that the links to the queries and blank results spreadsheets do not work, which is most likely because Dropbox is blocked wherever people are trying to connect. I am not planning on moving these to Github any time soon.

I also occasionally get reports that some of the queries simply don’t work. This usually turns out to be an issue where people have some of their user databases in 80 compatibility mode, which breaks many DMV queries, or that someone is running an incorrect version of the script for their version of SQL Server.

It is very important that you are running the correct version of the script that matches the major version of SQL Server that you are running. There is an initial query in each script that tries to confirm that you are using the correct version of the script for your version of SQL Server. If you are not using the correct version of these queries for your version of SQL Server, some of the queries are not going to work correctly.

If you want to understand how to better run and interpret these queries, you should consider listening to my three related Pluralsight courses, which are SQL Server 2014 DMV Diagnostic Queries – Part 1SQL Server 2014 DMV Diagnostic Queries – Part 2 and SQL Server 2014 DMV Diagnostic Queries – Part 3. All three of these courses are pretty short and to the point, at 67, 77, and 68 minutes respectively. Listening to these three courses is really the best way to thank me for maintaining and improving these scripts…

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

Useful Hardware Utilities – HWiNFO64

Since I have a personal and professional interest in PC hardware (I have actually been accused by my friend Steve Jones of “loving hardware”), I like to find and talk about useful hardware utilities that are relevant for both personal machines and for PC-based servers.

One very interesting utility is HWiNFO64 from Martin Malík. This program does a pretty complete job of examining your system, from the details of the CPU, motherboard, chipset, BIOS version, GPU, memory, drives, and operating system. It also lets you drill into different components of your system to see even more details about your hardware and configuration status.

You might be wondering why this is relevant to a typical database professional? Well, first, I think DBAs should have some knowledge and interest in the hardware that their database servers are running on (whether it is a bare metal physical host, or a virtualization host), since this has a big effect on their performance and SQL Server licensing costs. Second, being aware of some of the seemingly trivial details of your hardware can have a huge positive benefit on performance.

For example, if you are using a hypervisor, such as VMware or Hyper-V, you want to make sure your hardware virtualization support is enabled in your BIOS/UEFI. This includes Intel VT-x (Intel Virtualization Technology) and VT-d (Intel Virtualization Technology for Directed I/O).

In HWiNFO64, the VMX (Virtual Machine Extensions) lettering in the Features box of the System Summary as shown in Figure 1, tells you whether VT-x is enabled or not. If it is grey, it is not supported. If it is green, it is supported and enabled. In my case, I have an Intel Core i7-6700K processor that supports VT-x, but I currently have it disabled in my BIOS/UEFI. In CPU-Z, VT-x is simply absent in the Instructions box, since it is disabled in the BIOS/UEFI, as shown in Figure 2.

Another example is Intel Speed Shift Technology (shown as SST in the Features box of the System Summary as shown in Figure 1). It shows up in red on my system, since I have a BIOS feature called multi-core enhancement (MCE) enabled, which runs all of my processor cores at full Turbo Boost speed all of the time.

Intel Speed Shift Technology is an interesting feature that is present in Intel Skylake and later processors, that also requires operating system support. Current builds of Windows 10 and Windows Server 2016 support this feature, which I think will be beneficial for some SQL Server workloads.



Figure 1: HWiNFO64 System Summary



Figure 2: CPU-Z 1.78 CPU Tab


Figure 3 shows part of the Sensor Status windows, which lets you see details about your memory usage, component voltage and speeds, component temperatures, etc..



Figure 3: HWiNFO64 Sensor Status


Figure 4 shows details about the MSI Geforce GTX 1060 ARMOR OC video card that is in my workstation, which is a very nice mid-range video card.



Figure 4: HWiNFO64 Video Adapter Details