Try to code some sql statement to catch the consume much CPU time sps.

SELECT TOP 25 

       GETDATE()               AS runtime,

       qs.Execution_count      AS Executions,

       qs.total_worker_time    AS TotalCPU,

       qs.total_physical_reads AS PhysicalReads,

       qs.total_logical_reads  AS LogicalReads,

       qs.total_logical_writes AS LogicalWrites,

       qs.total_elapsed_time   AS Duration,

       qs.total_worker_time/qs.execution_count AS [AVG CPU TIME],

       SUBSTRING (qt.TEXT,qs.statement_start_offset/2,(CASE WHEN qs.statement_end_offset = -1

                                                            THEN LEN (CONVERT (NVARCHAR(MAX), qt.TEXT)) * 2

                                                            ELSE qs.statement_end_offset

                                                         END - qs.statement_start_offset)/2) AS query_text,

       qt.dbid AS DBID,

       qt.objectid AS OBJECT_ID,

       CAST ( query_plan AS XML) AS XMLPlan

FROM sys.dm_exec_query_stats qs

CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS qt

CROSS APPLY sys.dm_exec_query_plan(plan_handle)

ORDER BY TotalCPU DESC

你可能感兴趣的:(statement)