查询SqlServer最近执行过的Sql
SELECT TOP 1000
ST.text AS '执行的SQL语句' ,
QS.execution_count AS '执行次数' ,
QS.total_elapsed_time / 10000 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 '2018-04-17'
AND GETDATE()
ORDER BY creation_time DESC
人各有命,上天注定,有人天生为王,有人落草为寇。脚下的路,如果不是你自己的选择,那么旅程的终点在哪,也没人知道。你会走到哪,会遇到谁,都不一定。