![]() |
|
|
By: Jeremy Kadlec | Read Comments | Print Jeremy is the CTO @ Edgewood Solutions, co-founder of MSSQLTips.com and SQL Server MVP since 2009. Related Tips: More |
|
Problem
From SQL Server 2000 to 2005, many of the core SQL Server system metrics have migrated from static commands to dynamic management views and functions that can be queried to gather statistics in real time. The new dynamic management views and functions offer a great deal of flexibility to troubleshoot system issues, especially for WAITSTATS where the the number of milliseconds are captured for threads that are waiting on resources to complete their current batch or query. This information is very valuable to gain an insight into how applications are using SQL Server and the cause and effect of waiting for resources (memory, CPU, disk, etc.). Armed with this information, it should be possible to better tune your applications for greater levels of concurrency and throughput.
Solution
In SQL Server 2000, the command to capture the wait stats was DBCC SQLPERF('WAITSTATS'), although the SQL Server 2000 Books Online documentation always referenced 'LOGSPACE' to assess the current transaction log usage for all databases. In SQL Server 2005, the corresponding dynamic management object is sys.dm_os_wait_stats.
Let's take a look a the examples of each and how they compare.
Example - SQL Server 2000

Example - SQL Server 2005

What are the column mappings between the two commands?
| ID | Description | DBCC SQLPERF('WAITSTATS') SQL Server 2000 |
sys.dm_os_wait_stats SQL Server 2005 |
| 1 | Counter name i.e. 1 of the wait stats that SQL Server captures | Wait Type | wait_type |
| 2 | Count of the wait_type which is incremented by 1 each time the wait_type occurs | Requests | waiting_tasks_count |
| 3 | Total time in milliseconds including the signal_wait_time | Wait Time | wait_time_ms |
| 4 | Maximum wait time for the wait_type | N\A | max_wait_time_ms |
| 5 | Difference between the time the waiting thread was signaled and when it started running in milliseconds | Signal Wait Time | signal_wait_time |
What are the wait types that sys.dm_os_wait_stats captures?
Next Steps
| Share: | Share | Tweet |
|
![]() |
![]() |
Connect with MSSQLTips.com |
|
privacy | disclaimer | copyright | advertise | about authors | contribute | feedback | giveaways | user groups Some names and products listed are the registered trademarks of their respective owners. Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com |