码迷,mamicode.com
首页 > 数据库 > 详细

SQL查询历史执行语句

时间:2019-11-21 11:39:58      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:sel   stat   like   des   count   ota   http   cal   读取   

SELECT TOP 1000 
       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 ‘执行时间‘ ,  
       QS.*
FROM   sys.dm_exec_query_stats QS
       CROSS APPLY 
sys.dm_exec_sql_text(QS.sql_handle) ST
WHERE  QS.creation_time BETWEEN ‘2019-11-21 10:00:00‘ AND ‘2019-11-21 11:00:00‘ 
and st.text like ‘%update%‘ 
ORDER BY QS.creation_time desc

  摘自:https://blog.csdn.net/weixin_34309435/article/details/86030675

SQL查询历史执行语句

标签:sel   stat   like   des   count   ota   http   cal   读取   

原文地址:https://www.cnblogs.com/zengtianli/p/11904441.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!