View the IO of a database file

Source: Internet
Author: User

IO operations on the data are written to the database file, sys.dm_io_virtual_file_stats Returns I/O statistics for data and log files.

Nullnull }) 

io_stall: Total time, in milliseconds, which users waited for I/O to is completed on the file.

size_on_disk_bytes: Number of bytes used on the disk for this file.

View the IO of the database file and the time to wait for IO to complete

Selectvfs.database_id, VFS.file_id, Mf.type_desc asFile_type, Vfs.sample_ms/ +/ -/ -  asDuration_h, Vfs.num_of_reads asreads, Vfs.num_of_bytes_read/1024x768/1024x768  asREAD_MB, Vfs.num_of_bytes_read/Vfs.num_of_reads/1024x768  asavg_read_kb, Vfs.io_stall_read_ms/Vfs.num_of_reads asAvg_stall_read_ms, Vfs.num_of_writes aswrites, Vfs.num_of_bytes_written/1024x768/1024x768  asWRITTEN_MB, Vfs.num_of_bytes_written/Vfs.num_of_writes/1024x768  asavg_writted_kb, Vfs.io_stall_write_ms/Vfs.num_of_writes asAvg_stall_write_ms, Vfs.io_stall/(vfs.num_of_reads+Vfs.num_of_writes) asAvg_stall_ms,cast(vfs.size_on_disk_bytes/1024x768/1024x768/1024.0  as decimal(Ten,2)) asDISK_SIZE_GB,cast(mf.size/1024x768*8/1024.0  as DECIMAL(Ten,2)) asFILE_SIZE_GB, Vfs.file_handle fromsys.master_files MF CrossAPPLY Sys.dm_io_virtual_file_stats (MF.DATABASE_ID,MF.file_id) asVFSwheremf.database_id=db_id()--Current dbOrder  byAvg_stall_read_msdesc, Avg_stall_write_msdesc


Reference doc:

SYS.DM_IO_VIRTUAL_FILE_STATS (Transact-SQL)

SYS.MASTER_FILES (Transact-SQL)

View the IO of a database file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.