How to find cached execution plan and delete if required.

Find cached execution plan

An execution plan, simply put, is the result of the query optimizer’s attempt to calculate the most efficient way to implement the request represented by the T-SQL query you submitted. Execution plans can tell you how a query will be executed, or how a query was executed. Ref:

Execute the below query to find the cached execution plan.

SQL Execution plan
SQL Execution plan

Now if you want to delete a particular execution plan from the cache then you will need copy the token from the result and pass to DBCC FREEPROCCACHE


Before deleting  the plan:

Execution Plan before deleting
Execution Plan before deleting

Then run

And now to see if that got deleted, run the first query again.

After deleting the cache plan
After deleting the cached plan


Facebook Comments Box


Leave a Reply

Your email address will not be published.