Sample Header Ad - 728x90

Pulling Top queries returns NULL in query plan and sql text

4 votes
2 answers
2819 views
I'm using the following code to pull our top 20 queries (ordered by CPU): SELECT TOP 20 qs.sql_handle ,qs.execution_count ,qs.total_worker_time AS [Total CPU] ,qs.total_worker_time / 1000000 AS [Total CPU in Seconds] ,(qs.total_worker_time / 1000000) / qs.execution_count AS [Average CPU in Seconds] ,qs.total_elapsed_time ,qs.total_elapsed_time / 1000000 AS [Total Elapsed Time in Seconds] ,st.TEXT ,qp.query_plan FROM sys.dm_exec_query_stats AS qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) AS qp ORDER BY qs.total_worker_time DESC However, I'm seeing this: enter image description here Can anyone shed some light as to why the Query Plan and SQL Text are showing up NULL? Are they some sort of system process or external application? We are running SQL 2008 R2. Thanks, as always, everyone!
Asked by Kris Gruttemeyer (3879 rep)
Sep 10, 2014, 02:11 PM
Last activity: Jan 6, 2023, 11:04 AM