SQLTeam.com | Weblogs | Forums

Delete bad query plan


#1

Hi all,

I have a query that periodically decides to use a bad query plan. Since our devs use LINQ, they can't use HINTS to stop this. I'd like to delete the bad plan but don't know how to find the plan_handle. I'm using a tool called IGNITE but it just tells me this...

Plan Hash: 4573096045

Which is meaningless for SQL Server. What is the best way to track down the plan_handle so that I can delete it. I do realize that SQL Server will likely re-create the plan (for some reason) even though it causes the query to run more slowly but this may buy us enough time to rewrite the code to use raw SQL (with a hint) instead of LINQ.

Thanks!


#2

see Find Query Plan

and look for yours. You can limit the search by adding a WHERE clause on the st.TEXT column