Advertisement
bytecoded

Average Read and Write Delays

Oct 29th, 2019
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.61 KB | None | 0 0
  1. USE master
  2. GO
  3.  
  4. SELECT
  5.     CAST(db_name(a.database_id) AS VARCHAR) AS 'Database',
  6.     b.physical_name                         AS 'File',
  7.     a.size_on_disk_bytes                    AS 'Size',
  8.     a.io_stall_read_ms / a.num_of_reads     AS 'Avg. Read Delay',
  9.     a.io_stall_write_ms / a.num_of_writes   AS 'Avg. Write Delay'
  10.  
  11. FROM
  12.     sys.dm_io_virtual_file_stats(NULL, NULL) a
  13.    
  14.     INNER JOIN sys.master_files b
  15.     ON
  16.         a.database_id = b.database_id
  17.         AND a.file_id = b.file_id
  18.  
  19. WHERE
  20.     num_of_writes       > 0
  21.     AND num_of_reads    > 0
  22.  
  23. ORDER BY
  24.     'Database',
  25.     a.io_stall DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement