wait--using Sys.dm_io_virtual_file_stats to view IO latency

Source: Internet
Author: User

/*============================================================================ File: Virtualfilestats.sql Summary:sys.dm_io_virtual_file_stats Date:march----------------------------------- -------------------------------------------written by Paul S. Randal, SQLskills.com (c), sqlskills.com.  All rights reserved. For more scripts and sample code, check out http://www. SQLskills.com the alter this code for your own *non-commercial* purposes. Republish altered code as long as you include this copyright and give due credits, but you must obtain prior perm    Ission before blogging this code. This CODE and information was provided "as is" without WARRANTY of any KIND, either expressed OR implied, including but Not LIMITED to the implied warranties of merchantability and/or FITNESS for A particular purpose.====================== ======================================================*/--Use this script, based on code from Jimmy may--This is the I use on client systemsSELECT     --Virtual File LatencyReadlatency=         Case  whenNum_of_reads= 0             Then 0 ELSE(Io_stall_read_ms/Num_of_reads)END, Writelatency=         Case  whenNum_of_writes= 0              Then 0 ELSE(Io_stall_write_ms/Num_of_writes)END, Latency=         Case  when(num_of_reads= 0  andNum_of_writes= 0)             Then 0 ELSE(Io_stall/(num_of_reads+Num_of_writes))END,  --avg bytes per IOPAvgbperread=         Case  whenNum_of_reads= 0              Then 0 ELSE(Num_of_bytes_read/Num_of_reads)END, Avgbperwrite=         Case  whenIo_stall_write_ms= 0              Then 0 ELSE(Num_of_bytes_written/Num_of_writes)END, Avgbpertransfer=         Case  when(num_of_reads= 0  andNum_of_writes= 0)             Then 0 ELSE((Num_of_bytes_read+Num_of_bytes_written)/(Num_of_reads+Num_of_writes))END,                  Left(Mf.physical_name,2) asDrive ,db_name(vfs.database_id) asDB, VFS.*, Mf.physical_name fromSys.dm_io_virtual_file_stats (NULL,NULL) asVFSJOINSys.master_files asMF onvfs.database_id=mf.database_id andVfs.file_id =Mf.file_id--WHERE vfs.file_id = 2--Log files--ORDER by Latency DESC--ORDER by Readlatency DESCORDER  byWritelatencyDESC

wait--using Sys.dm_io_virtual_file_stats to view IO latency

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.