Hi Folks,
In this article we are going to cover How to Find Cumulative IO Stats.
In this post we are going to discuss following points:
- Problem Statement of SQL Script:
- Description of SQL Script:
- SQL Script Output Column
- SQL Script Code
- SQL Script Output Screenshot
- User Level to execute
Problem Statement of SQL Script:
How to Find Cumulative IO Stats?
Description of SQL Script:
This script will show the amount of IO that has been done for each database file. As well as this it will show the read/write work load split as well as showing what sort of wait times you have for each io request type.
An important aspect to note with this particular data is that the values are transient in that a server restart for example will reset them.
SQL Script Output Column
SQL Script Code
SELECT QUOTENAME(DB_NAME(iovfs.[database_id])) [DatabaseName] ,iovfs.[file_id] [FileID] ,mf.[name] [LogicalName] ,mf.[type_desc] [FileType] ,SUM(iovfs.[num_of_bytes_read]) [Read_bytes] ,SUM(iovfs.[num_of_bytes_written]) [Written_bytes] ,SUM(iovfs.[num_of_bytes_read]) / 1048576 [Read_MiB] ,SUM(iovfs.[num_of_bytes_written]) / 1048576 [Written_MiB] ,SUM(iovfs.[num_of_reads]) [Read_Count] ,SUM(iovfs.[num_of_writes]) [Write_Count] ,SUM(iovfs.[num_of_reads] + iovfs.[num_of_writes]) [IO_Count] ,CONVERT(DECIMAL(15, 2), SUM([num_of_bytes_read]) / ( SUM([num_of_bytes_read] + [num_of_bytes_written]) * 0.01 )) [Read_Percent] ,CONVERT(DECIMAL(15, 2), SUM([num_of_bytes_written]) / ( SUM([num_of_bytes_read] + [num_of_bytes_written]) * 0.01 )) [Write_Percent] ,CONVERT(DECIMAL(15, 2), COALESCE(SUM(iovfs. [io_stall_read_ms]) / NULLIF(SUM(iovfs. [num_of_reads] * 1.0), 0), 0)) [AverageReadStall_ms] ,CONVERT(DECIMAL(15, 2), COALESCE(SUM(iovfs. [io_stall_write_ms]) / NULLIF(SUM(iovfs. [num_of_writes] * 1.0), 0), 0)) [AverageWriteStall_ms] FROM sys.master_files mf INNER JOIN sys.dm_io_virtual_file_stats(NULL, NULL) iovfs ON mf. [database_id] = iovfs.[database_id] AND mf.[file_id] = iovfs.[file_id] GROUP BY iovfs.[database_id] ,iovfs.[file_id] ,mf.[name] ,mf.[type_desc] ORDER BY QUOTENAME(DB_NAME(iovfs.[database_id])) ,iovfs.[file_id]
SQL Script Output Screenshot
User Level to execute
300
Hope you will like How to Find Cumulative IO Stats.
If you really like reading my blog and understood at least few thing then please don’t forget to subscribe my blog.
If you want daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog :
For More information related to BI World visit my Mentalist Blog
SQL Server Mentalist >> SQL Learning Blog
Business Intelligence Mentalist >> BI World
Infographic Mentalist >> Image worth explaining thousand Words
Microsoft Mentalist >> MVC,ASP.NET, WCF & LinQ
DBA Mentalist >>Advance SQL Server Blog
Microsoft BI Mentalist >> MS BI Development Update
Connect With me on
Filed under: Link, Microsoft SQL Server, MSBI, Optimization, Query, Script, SQL Mentalist, SQL PraRup, SQL Query, SQL Server, SQL Tricks, Technology,, TSQL, Vishal Pawar Tagged: DBA, Fast SQL, Microsoft SQL Server, SQL Help, SQL Mentalist, SQL Script, SQL Server, SQL Server 2008 R2, SQL Server 2012, SQL tips, SQL Tricks, TSQL, Vishal Pawar
