SELECT TOP 1000 QS.creation_time 时间, SUBSTRING(ST.text,(QS.statement_start_offset/2)+1,((CASE QS.statement_end_offset WHEN -1 THEN DATALENGTH(st.text) ELSE QS.statement_end_offset END - QS.statement_start_offset)/2)+1) AS 语句块, ST.text as 语句, QS.total_worker_time as 总执行时间毫秒, QS.last_worker_time as 上次执行时间毫秒, QS.max_worker_time as 最大执行时间毫秒, QS.min_worker_time as 最小执行时间毫秒 FROM sys.dm_exec_query_stats QS CROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) ST WHERE QS.creation_time BETWEEN convert(varchar(10),getdate(),23) AND convert(varchar(10),getdate()+1,23) ORDER BY QS.total_worker_time DESC
资源来源:@马小龙
原文地址:https://www.cnblogs.com/chenxizhaolu/p/9928209.html
时间: 2024-10-26 00:13:52