order by (total_logical_reads + total_logical_writes)/execution_count Desc
select top 5 (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, statement_start_offset, p.query_plan, q.text
from sys.dm_exec_query_stats
cross apply sys.dm_exec_query_plan(plan_handle) p
cross apply sys.dm_exec_sql_text(plan_handle) as q
order by (total_logical_reads + total_logical_writes)/execution_count Desc
下面的 DMV 查詢可用于查找哪些批處理/請求生成的 I/O 最多。如下所示的 DMV 查詢可用于查找可生成最多 I/O 的前五個請求。調整這些查詢將提高系統性能。
view plaincopy to clipboardprint?
select top 5
(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_phys_reads,
Execution_count,
statement_start_offset as stmt_start_offset,
sql_handle,
plan_handle
from sys.dm_exec_query_stats
order by (total_logical_reads + total_logical_writes) Desc
文章來源于領測軟件測試網 http://www.kjueaiud.com/