SQL SERVER 查询历史执行语句

Select TOP 10
ST.text AS '执行的SQL语句',
QS.execution_count AS '执行次数',
QS.total_elapsed_time AS '耗时',
QS.total_logical_reads AS '逻辑读取次数',
QS.total_logical_writes AS '逻辑写入次数',
QS.total_physical_reads AS '物理读取次数',
QS.creation_time AS '执行时间'

FROM sys.dm_exec_query_stats QS
CROSS APPLY
sys.dm_exec_sql_text(QS.sql_handle) ST
Where QS.creation_time > dateadd(minute,-1,GETDATE()) --当前时间前一分钟
-- Where QS.creation_time BETWEEN '2015-08-01 00:00:00' AND '2015-09-02 11:00:00'
ORDER BY QS.total_elapsed_time DESC

上一篇:openTSDB详解之Deferred类


下一篇:首页> C#>如何创建一个文本文件,并用一个文本框或变量命名