Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » System Statistical Functions RSS Feeds

fn_virtualfilestats Function

Posted By: Sarita Patel     Category: SQL Server     Views: 1553

This article explains about fn_virtualfilestats function in sql server with examples.

fn_virtualfilestats function returns I/O statistics for database files including log files.

Syntax of @@CPU_BUSY Function :

fn_virtualfilestats ( [@DatabaseID=] database_id, [ @FileID = ] file_id )

[@DatabaseID=] database_id is an ID of the database. database_id is int, with no default.

[@FileID = file_id is an ID of the file. file_id is int, with no default.

It returns below fields.

Column

Datatype

Description

DbId

smallint

Database ID

FileId

smallint

File ID

TimeStamp

int

Time at which the data was taken

NumberReads

bigint

Number of reads issued on the file

NumberWrites

bigint

Number of writes made on the file

BytesRead

bigint

Number of bytes read issued on the file

BytesWritten

bigint

Number of bytes written made on the file

IoStallMS

bigint

Total amount of time, in milliseconds, that users waited for the I/Os to complete on the file

 




Examples of fn_virtualfilestats Function :

Example 1 : Use of fn_virtualfilestats function in select clause 

SELECT  NumberReads, NumberWrites, BytesRead, BytesWritten 
FROM    :: fn_virtualfilestats(1, 1)

Output
NumberReads        NumberWrites         BytesRead       BytesWritten
75                          1                             614400            8192

Above example returns information about file id 1 of database id 1.
  
Share: 


Didn't find what you were looking for? Find more on fn_virtualfilestats Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of fn_virtualfilestats Function is from United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!