forked from vincent/notebook
33 lines
1.1 KiB
Transact-SQL
33 lines
1.1 KiB
Transact-SQL
-- top 10 des requêtes les plus pourries
|
|
SELECT TOP 10
|
|
SUBSTRING(text,
|
|
(statement_start_offset/2) + 1,
|
|
((CASE statement_end_offset
|
|
WHEN -1 THEN DATALENGTH(text)
|
|
ELSE statement_end_offset
|
|
END - statement_start_offset)/2) + 1)
|
|
AS QUERY,
|
|
*
|
|
FROM sys.dm_exec_query_stats
|
|
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
|
|
CROSS APPLY sys.dm_exec_query_plan(plan_handle);
|
|
GO
|
|
|
|
-- top 10 des procédures les plus pourries
|
|
SELECT *
|
|
FROM sys.dm_exec_procedure_stats
|
|
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
|
|
CROSS APPLY sys.dm_exec_query_plan(plan_handle);
|
|
|
|
-- top 10 des déclencheurs les plus pourries
|
|
SELECT *
|
|
FROM sys.dm_exec_trigger_stats
|
|
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
|
|
CROSS APPLY sys.dm_exec_query_plan(plan_handle);
|
|
|
|
-- top 10 des UDF les plus pourries
|
|
SELECT *
|
|
FROM sys.dm_exec_function_stats
|
|
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
|
|
CROSS APPLY sys.dm_exec_query_plan(plan_handle);
|