天天看点

SQL Server 2005 排查I/O瓶颈

-- top 10 引发i/o

SELECT (total_logical_reads/execution_count) AS avg_logical_reads

,(total_logical_writes/execution_count) AS avg_logical_writes

,(total_physical_reads/execution_count) AS avg_physical_reads

,execution_count

,(SELECT SUBSTRING(text,statement_start_offset/2 +1,

(CASE WHEN statement_end_offset = -1

THEN LEN(CONVERT(NVARCHAR(max),text)) *2

ELSE statement_end_offset

END - statement_start_offset)/2)

FROM sys.dm_exec_sql_text(sql_handle)) AS query_text

FROM sys.dm_exec_query_stats

ORDER BY (total_logical_reads + total_logical_writes)