Solved

SQL Server weird behavior; DBCC FLUSHPROCINDB temporarily resolves issues

Posted on 2009-04-07
2
857 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
2 Comments
 
LVL 32

Accepted Solution

by:
bhess1 earned 500 total points
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now