DB Instance에 성능을 많이 사용하고 있는 쿼리에 대한 실행 계획을 조회하는 쿼리입니다.
SELECT TOP 20
db_name(qp.dbid) AS dbName
, execution_count AS execCnt
,(total_worker_time / execution_count) / 1000 AS avgCPU
,(total_elapsed_time / execution_count) / 1000 AS avgDuration
, total_logical_reads / execution_count AS avgReads
, max_worker_time AS maxCPU
, max_elapsed_time AS maxDuration
, max_logical_reads AS maxReads
, total_worker_time / 1000 AS totalCPU
, total_logical_reads as totalReads
, qp.query_plan
FROM sys.dm_exec_query_stats AS deqs
OUTER APPLY sys.dm_exec_query_plan(deqs.plan_handle) AS qp
ORDER BY deqs.total_worker_time DESC;
GO
'SQL Server' 카테고리의 다른 글
[MSSQL] 22. DB 로그인 Login 계정 조회 쿼리 (0) | 2023.05.11 |
---|---|
[MSSQL] 20. 미싱 인덱스 Missing Index 확인 쿼리 (0) | 2023.05.11 |
[MSSQL] 19. 성능 많이 먹는 프로시저 조회 (0) | 2023.04.25 |
[MSSQL] 18. 성능 많이 먹는 쿼리 조회 (0) | 2023.04.25 |
[MSSQL] 17. 파티션 테이블 조회 및 Row수 구하기 (0) | 2023.04.25 |