Find Query Reuse (Execution Plan Reuse)

[cc lang=”sql”]
— find counts of query re-use
SELECT * FROM
(
select *, (select object_name(objectid) from sys.dm_exec_sql_text(p.plan_handle)) AS SNAME
from sys.dm_exec_cached_plans p
where usecounts <= 1 --and objtype != 'adhoc' --and objtype != 'prepared' ) t WHERE SNAME IS NOT NULL order by usecounts, size_in_bytes desc [/cc]

2 comments
Appu 14 May 2012 at 4:25 am

it’s very impotent to be aware of the reevesrd words, I built a cms that has a filed in each table called (CONDITION) and now its reevesrd in mysql 5.. it took me a lot of time to alter all the tables and the php code in all the sites that uses this cms Thanks Steve

Featured Articles

 Site Author

  • Thanks for visiting!
css.php