RMJCS Logo
 

sys.dm_os_latch_stats

 
 

BOL: Returns information about all latch waits organized by class.

The latch equivalent to sys.dm_os_wait_stats. There are in the region of 120 different latch types, BOL provides a brief description for each of them. The counters can be reset using DBCC SQLPERF ('sys.dm_os_latch_stats', CLEAR). The counters do not track latch requests that succeed or fail without a wait.

 
     
 

Formatted query for sys.dm_os_latch_stats

 
 
SELECT     
   ls.latch_class,
   ls.waiting_requests_count,
   CASE WHEN ls.waiting_requests_count = 0 THEN 0 ELSE ls.wait_time_ms / ls.waiting_requests_count END as average_wait_time_ms,
   ls.wait_time_ms,
   ls.max_wait_time_ms
FROM
   sys.dm_os_latch_stats ls
WHERE
   -- Restrict results to wait types that have actually occurred.
   ls.waiting_requests_count > 0
ORDER BY
   ls.latch_class
 
     
Copyright 2007-2015 RMJCS Ltd