SELECT TOP 100 (A.TOTAL_WORKER_TIME/A.EXECUTION_COUNT) AS [AVG_CPU_TIME] , CONVERT(VARCHAR, LAST_EXECUTION_TIME) AS 'LAST_EXECUTION_TIME', TOTAL_PHYSICAL_READS, SUBSTRING(B.TEXT, A.STATEMENT_START_OFFSET/2,(CASE WHEN A.STATEMENT_END_OFFSET = -1 THEN LEN(CONVERT(NVARCHAR(MAX), B.TEXT)) *2 ELSE A.STATEMENT_END_OFFSET END - A.STATEMENT_START_OFFSET)/2) AS QUERY_TEXT , DBNAME = UPPER(DB_NAME(B.DBID)) , B.OBJECTID AS 'OBJECT_ID' FROM SYS.DM_EXEC_QUERY_STATS A CROSS APPLY SYS.DM_EXEC_SQL_TEXT(A.SQL_HANDLE) AS B ORDER BY [AVG_CPU_TIME] DESC
728x90
반응형
'DB > Mssql' 카테고리의 다른 글
mssql 시퀀스 지정 방법 (0) | 2018.01.09 |
---|---|
mssql 날짜 형식 변환 (0) | 2018.01.09 |
mssql 테이블 복사 (0) | 2018.01.09 |
mssql 열을 가로로 출력 (0) | 2018.01.09 |
mssql update alias (0) | 2018.01.09 |