查看系統中最近執行的語句sql
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 '2018-12-17 00:00:00' AND '2018-12-19 11:00:00' ORDER BY QS.creation_time desc;