Solved

SQL Server weird behavior; DBCC FLUSHPROCINDB temporarily resolves issues

Posted on 2009-04-07
2
866 Views
Last Modified: 2012-05-06
Experts, I have an interesting problem that has no easy solution.  Furthermore I do not know the exact problem, just the symptoms and what has temporarily resolved it:

Approximately every 2-3 hours our database will run excessively slow.
-every call to the database is through stored procedures.
-web service calls (hitting the DB) that usually take 1-2 seconds now time out (180 seconds)
-windows services that poll the DB now time out

When we run the command 'DBCC FLUSHPROCINDB...' to clear the execution plans the database immediately speeds up and we experience no more time outs.  However, 2-3 hours later the database slows again and the time outs occur.

My question to you experts, is what steps do I take to find the specific problem? Running 'DBCC FLUSHPROCINDB(...)' every 2-3 hours is not acceptable as it is not resolving the problem.  How can I further diagnose and pinpoint the culprit?  Could one bad stored procedure execution plan slow down an entire database?  Anyone experience something similar with regards to 'DBCC FLUSHPROCINDB(...)' temporarily "fixing" the database?


0
Comment
Question by:thecoon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
bhess1 earned 500 total points
ID: 24093137
The problem is almost certainly in the way the applications work with queries, or stored procedures with RECOMPILE flags for each call.  What is happening is a side effect of the fact that SQL Server just continues to grow the procedure cache .... and grow, and grow, and grow, until you run out of available memory, at which point... it continues to grow, leading to disk swapping of memory that just slows your system to a crawl.

Your quick workaround is to run the DBCC command on a schedule, every 90 minutes say, to keep things running.  Your long term goal is to revise code to make more reuse of the same plans
0
 
LVL 3

Author Comment

by:thecoon
ID: 24101701
bhess1, all of the queries through applications are done via stored procedures without RECOMPILE flags.  The only thing I can think of that might make the procedure cache grow is we use dynamic SQL in several stored procedures that are called infrequently (procedure is called ~3,000 times in a day, but we have stored procedures that are called 180,000 times a day).

Do you have any good articles on procedure cache, for what you are talking about, that could help me?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question