info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



File Usage Statistics
by BF (Principal Consultant; Architecture; Engineering)
2022-02-08







SELECT
@@SERVERNAME As 'Server Name',
DB_NAME(dbid) As 'Database Name',
physical_name As 'File Name',
Type_Desc As 'File Type',
NumberReads As '# of Reads',
BytesRead As 'Bytes Read',
NumberWrites As '# of Writes',
BytesWritten As 'Bytes Written',
IoStallReadMS As 'IO Stall Read',
IoStallWriteMS As 'IO Stall Write',
IoStallMS As 'Total IO Stall (ms)',
GETDATE() As 'Collection Date'
FROM
fn_virtualfilestats(NULL,NULL) vfs
inner join sys.master_files mfi ON vfs.dbid = mfi.database_id AND vfs.fileid = mfi.file_id
ORDER BY
DB_NAME(dbid)