sqlserver查询执行时间过长的sql
时间:2021-07-01 10:21:17
帮助过:4人阅读
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
资源来源:@马小龙
sqlserver查询执行时间过长的sql
标签:bst weight sel tar sys off select ast creat