Following our last post by Mehmet about new support and troubleshooting DMV’s, here are additional details on supportability DMV changes in SQL 2008 R2 SP1 and how you might use them. These changes are also available in “Denali”, the upcoming major release of SQL Server. With SQL 2008 R2 SP1 coming up soon, please give them a try and let us know what you think.
We’ll take a peek at these DMV changes as well as talk about in what circumstances these DMVs would come in handy. Note that all DMVs/DMF documented below require VIEW SERVER STATE permission.
1. Extended sys.dm_exec_query_stats with 4 new columns (total/last/min/max_row)
sys.dm_exec_query_stats is a very widely used DMV that provides useful information in analyzing query performance. To troubleshoot long running queries, it is also helpful to have total/min/max/last row counts information in order to separate queries that are simply returning a large number of rows from those problematic ones due to, say, a missing index or a bad query plan.
2. sys.dm_os_volume_stats(f.database_id, f.file_id)
This is a new DMF (Dynamic Management Function) that helps check the free space on the partitions the SQL server instance resides on. The catalog view sys.database_files provides stats such as size per database file, however, without information about free space on the partition, the information is less actionable – a database file cannot autogrow even when the size is small if there is not sufficient space left on the partition.
For example, you can use the following T-SQL statements to get the stats for the current database.
select database_id, f.file_id, total_bytes, available_bytes from sys.database_files as f cross apply sys.dm_os_volume_stats(DB_ID(), f.file_id)
int, not null
ID of the database
ID of the file
Mount point at which the volume is rooted
OS volume ID
Logical volume name
Type of file system volume (e.g., NTFS, FAT, RAW)
Total size in bytes of the volume
Available free space on the volume
Does this volume support OS compression?
Does this volume support alternate streams
Does this volume support sparse files?
Is this volume currently marked read_only?
Is this volume currently compressed?
This new DMV provides information on the OS the SQL Server instance is running on, specifically including the following:
Without this DMV, it is very difficult to get such information without calling into Windows APIs.
It’s also worth pointing out that a related change we made to existing DMV sys.dm_os_sys_info is to add two new columns (virtual_machine_type, virtual_machine_type_desc) to provide information when the SQL Server instance is running in a virtual machine environment.
This DMV provides registry key information related to the overall configuration/installation of the SQL Server instance.
The following groups of registry keys are covered in this DMV:
1) To help find out what SQL Server services are available on the host machine
2) To help find out what SQL Agent services are available on the host machine
3) To find out the current version of SQL Engine
4) To help with instance detectability, etc. the following registry keys are helpful
5) To help troubleshoot connectivity issues (intermittent connections, high latency, etc.) that may be a result of misconfiguration
6) To help troubleshoot application issues due to incorrect settings in SQLServerAgent
This DMV provides information about three services related to SQL Server, namely SQL Server, SQL Agent and Fulltext (only available as of Denali). The DMV includes the following information about the current SQL instance:
This DMV provides information on memory dumps that have been generated as a result of a recent crash, for instance. Dump type may be minidump, all-thread dump or full dump.
Thanks for reading this far. We’d love to hear your feedback once you get a chance to try them out.