先清除暫存
dbcc freeProcCache
再下SQL
SELECT TOP 10
total_worker_time/1000000 AS [总消耗CPU 时间(s)],execution_count [运行次数],
qs.total_worker_time/qs.execution_count/1000000. as [平均消耗CPU 时间(s)],
SUBSTRING(qt.text,qs.statement_start_offset/2+1,
(case when qs.statement_end_offset = -1
then DATALENGTH(qt.text)
else qs.statement_end_offset end -qs.statement_start_offset)/2 + 1)
as [使用CPU的语法], qt.text [完整语法],
qt.dbid, dbname=db_name(qt.dbid),
qt.objectid,object_name(qt.objectid,qt.dbid) ObjectName
FROM sys.dm_exec_query_stats qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) as qt
ORDER BY
total_worker_time DESC
沒有留言:
張貼留言