查询Sql慢语句
Posted bug张
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了查询Sql慢语句相关的知识,希望对你有一定的参考价值。
SELECT TOP 10 execution_count as [Number Of Executions],
total_worker_time/execution_count as [Average CPU Time],
total_elapsed_time/execution_count as [Average Elapsed Time],
(
SELECT SUBSTRING(text,statement_start_offset/2,
(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 [Average CPU Time] DESC;
以上是关于查询Sql慢语句的主要内容,如果未能解决你的问题,请参考以下文章