getting average disk IO

  • Hi,

    I want to calculate average disk IO, is this query correct?

    IF ( ( SELECT TOP 1 sample_ms FROM sys.dm_io_virtual_file_stats(null,null)) < 0 ) BEGIN

    SELECT 'SQL Server Uptime is to big, no calculation possible - restart server'

    END

    ELSE BEGIN

    SELECTDB_NAME(database_id) AS [Database Name],

    SUM( num_of_bytes_read / sample_ms / 1000 ) AS [AVG reads: bytes / sec],

    SUM( num_of_bytes_written / sample_ms / 1000 ) AS [AVG writes: bytes / sec]

    FROMsys.dm_io_virtual_file_stats(null,null)

    GROUP BYdatabase_id, sample_ms

    ORDER BYSUM( num_of_bytes_read + num_of_bytes_written ) / sample_ms / 1000 DESC

    END

    Greetz Stefan

  • Take a look at http://sqlserverperformance.wordpress.com/2010/03/08/easy-ways-to-detect-io-pressure-in-sql-server-2008/ for some examples.

    :exclamation: "Be brave. Take risks. Nothing can substitute experience." :exclamation:

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply