Requête couteuse en CPU sous MSSQL

From Tuxunix
Jump to: navigation, search

MSSQL 2005

SELECT TOP 50 total_worker_time/execution_count AS [Avg CPU Time],execution_count,
SUBSTRING(st.text, (qs.statement_start_offset/2)+1,
((CASE qs.statement_end_offset WHEN -1
THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset
END -qs.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
Where execution_count >1000
ORDER BY [Avg CPU Time] DESC