Should I refresh query plan cache
5
votes
2
answers
9618
views
Please let me explain my problem and situation:
I have a web application - MVC3, MSSQL Server 2005, LinqToSQL. It has been running great until one fine morning I pushed a lot of rows to a table that is heavily used and since then I was getting query timeouts. In order to fix the problem I run the Database Tuning Advisor and I added some Indexes and Statistics. I also created a maintenance plan to rebuild indexes daily. After those additions, the application has been behaving unstable; it would work fast for couple of hours then it would start timing out again. Next, life forced me to clean up the table in matter, and the amount of rows in it is even smaller now than it was before but the timeouts are still happening. So, I removed all indexes that I created and now the website is much more stable but from time to time I still see some timeouts.
I've been trying to figure out how to fix those queries and when I profile it and paste the query directly into the SQL Management Studio it returns the results in 1 second, but when I run this query from my application, it's about 25 seconds. Then after it runs for the first time, next time it goes as fast as on the server!
I started doing some research and it looks like when I played with all those indexes my query plans got messed up and now they are creating issues.
My questions are :
1. Should I refresh my query plan cache (around 22000 queries - a lot of them has been used only once) and
2. If I do it, what would the impact be on the SQL while they are all rebuilding?
Asked by bobek
(161 rep)
Jul 18, 2013, 08:15 PM
Last activity: Jul 24, 2013, 05:10 PM
Last activity: Jul 24, 2013, 05:10 PM