본문 바로가기

운영/성능 및 실행계획

File IO 성능 확인

728x90
반응형

Windows Perfmon이나, Active Monitor에서 Disk IO를 확인하지 못하고 있을때 대안책입니다.

SELECT  DB_NAME(fs.database_id) AS [Database Name] ,
	mf.physical_name ,
        io_stall_read_ms ,
        num_of_reads ,
        CAST(io_stall_read_ms / ( 1.0 + num_of_reads )
		AS NUMERIC(10, 1))
			AS [avg_read_stall_ms] ,
        io_stall_write_ms ,
        num_of_writes ,
        CAST(io_stall_write_ms / ( 1.0 + num_of_writes ) 
		AS NUMERIC(10, 1)) 
			AS [avg_write_stall_ms] ,
        io_stall_read_ms + io_stall_write_ms AS [io_stalls] ,
        num_of_reads + num_of_writes AS [total_io] ,
        CAST(( io_stall_read_ms + io_stall_write_ms ) / 
		( 1.0 + num_of_reads+ num_of_writes ) 
		AS NUMERIC(10,1)) 
			AS [avg_io_stall_ms]
FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS fs
INNER JOIN sys.master_files AS mf WITH ( NOLOCK ) 
	ON fs.database_id = mf.database_id 
		AND fs.[file_id] = mf.[file_id]
WHERE DB_NAME(fs.database_id)='PBW'
ORDER BY avg_io_stall_ms DESC
728x90
반응형