Skip to content
 

Find Query Reuse (Execution Plan Reuse)

-- 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


Popular search terms:

One Comment

  1. Appu says:

    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

post a comment OR Post Your Question on our ASK! Community!