SELECT TOP 100
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
最新推荐文章于 2022-01-13 16:07:48 发布