본문 바로가기

연구개발/DBA

[DMV] Inefficient Query

728x90
반응형

-- inefficient query

SELECT

    highest_cpu_queries.plan_handle,

    highest_cpu_queries.total_worker_time,

    q.dbid,

    q.objectid,

    q.number,

    q.encrypted,

    q.[text]

FROM

    (SELECT top 50

        qs.plan_handle,

        qs.total_worker_time

    FROM

        sys.dm_exec_query_stats qs

    ORDER BY qs.total_worker_time DESC) AS highest_cpu_queries

    CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS q

ORDER BY highest_cpu_queries.total_worker_time DESC
728x90
반응형

'연구개발 > DBA' 카테고리의 다른 글

[DMV] Tempdb space  (0) 2011.11.04
[DMV] Top I/O Queries  (0) 2011.11.04
[DMV] Plans with large CPU consumption  (0) 2011.11.04
[DMV] Excessive compiles/recompiles  (0) 2011.11.04
[DMV] Active sessions, Sleeping and Background  (0) 2011.11.04