Home > SQL Server > SQL SERVER – Get File IO Statistics using sys.dm_io_virtual_file_stats – DMV – @SQLSERVER

SQL SERVER – Get File IO Statistics using sys.dm_io_virtual_file_stats – DMV – @SQLSERVER


sys.dm_io_virtual_file_stats is the Dynamic Management Function. It is used to retrieve the database files such as Data file and Log file I/O statistics.

This function returns the following information.

pic1This function requires two arguments such as DatabaseID and FileID. But, we can also use NULL as the function arguments if we need IO statistics information for all database files in that instance.

Example

1. Retrieving IO statistics for all databases in the current instance.

select * from sys.dm_io_virtual_file_stats(null,null)

2. Retrieving IO statistics for the current database only.

select * from sys.dm_io_virtual_file_stats(DB_ID(),null)

3. Retrieving IO statistics for the data files of the current database.

select * from sys.dm_io_virtual_file_stats(DB_ID(),FILE_IDEX(‘DataLab’))

Sample Outputpic2

File statistics information is very useful for performance tuning. We can use this data to understand the workload of a physical storage. It can act as a key data when we choose the drive for storing data and log file for high responsive database for the business application.

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: