DEFINITIONS

Definitions More Info.
Definition ID34
TitleSQL
CategorySCRIPT
Definitiontop 50 CPU consuming queries
Definition Description SELECT
highest_cpu_queries.last_execution_time,
highest_cpu_queries.execution_count,
q.[TEXT],
SUBSTRING( q.text, ( highest_cpu_queries.statement_start_offset / 2 )+ 1, (( CASE highest_cpu_queries.statement_end_offset WHEN - 1 THEN DATALENGTH( q.text ) ELSE highest_cpu_queries.statement_end_offset END - highest_cpu_queries.statement_start_offset )/ 2 ) + 1 ) AS statement_text,
highest_cpu_queries.total_worker_time,
q.dbid,
q.objectid,
q.number,
q.encrypted,
highest_cpu_queries.plan_handle
FROM
(
SELECT
top 50 qs.last_execution_time,
qs.execution_count,
qs.plan_handle,
qs.total_worker_time,
qs.statement_start_offset,
qs.statement_end_offset
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
--WHERE DATEDIFF(hour, last_execution_time, getdate()) < 1
-- change hour time frame order by highest_cpu_queries.total_worker_time desc
RecordBycunay
Record Date15-02-2012 15:04:12
Düzenle
Kopyala
Sil