[SQL Server] Afficher les requêtes et les plans d'exécution présents en double dans le cache SQL Server
select T1.query_hash,T1.number_of_entries
,T2.[text] AS requete
,T3.query_plan AS plan_exec_requete
from (
select top 20 query_hash,count(*) as number_of_entries
,min(sql_handle) as min_sql_handle
,min(plan_handle) as min_plan_handle
from sys.dm_exec_query_stats
group by query_hash
having count(*)>1
order by count(*) desc
) as T1
cross apply sys.dm_exec_sql_text(min_sql_handle) as T2
cross apply sys.dm_exec_query_plan(min_plan_handle) as T3