June 14, 2007 at 4:29 am
Is there a way to retire or flush a single cached query plan?
We had a problem this week, where a bad query plan had been stored for a frequently executed query. The first time it ran, it was for a yearly time sheet instead of a weekly time sheet. This made a bad plan query plan the rest of the queries for weekly time sheets.
We were able to find the query plan using sys.dm_exec_requests and sys.dm_exec_query_plan()
The only thing we could think of was to use dbcc freeproccache, but that isn't really a good option on a production database.
Can I find and remove a single cached plan?
June 14, 2007 at 4:54 am
I take it we're talking about a stored procedure here? If so, just use sp_recompile.
John
June 14, 2007 at 5:55 am
Unfortunately it's not a stored procedure, but a parameterized query.
June 14, 2007 at 6:41 am
Gotta love embedded SQL... and not trying to be a snit about this... check out the discussing beginning to unfold at the following URL... it's similar to many other discussions I've seen on the web...
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=23&messageid=373182&post=true
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply