--查询最近执行的Sql语句

SELECT TOP 1000 
       ST.text AS '执行的SQL语句',
       QS.execution_count AS '执行次数',
       QS.total_elapsed_time AS '耗时',--ms
       QS.last_worker_time AS '12',
       QS.total_logical_reads AS '逻辑读取次数',
       QS.total_logical_writes AS '逻辑写入次数',
       QS.total_physical_reads AS '物理读取次数',       
       QS.creation_time AS '执行时间' ,  
       QS.*
FROM   sys.dm_exec_query_stats QS
       CROSS APPLY 
sys.dm_exec_sql_text(QS.sql_handle) ST
WHERE  QS.creation_time BETWEEN '2016-06-23 10:00:00' AND '2016-06-23 23:00:00' 
ORDER BY  QS.creation_time DESC 

你可能感兴趣的:([,07,],SQL,Server)