Stored procedures performance issues
Every now and then I tend to see lot of questions such as "We have a web application which interacts with SQL Server through Stored Procs. Every so often it seems the response time for an individual Stored Proc will go from a few seconds to a few minutes. What is best way to determine cause?
First thing to check is do you have a schedule of database optimization tasks, also an intermittent schedule of SQL Server Profiler trace and blocking script can come in handy. I would run a profiler trace and blocking script for when it runs well versus when it runs poorly and look for differences.
Typically, blocking can be the culprit here, and to prove it you need to a run blocking script. Still, there could be many other reasons, including sudden, temporary changes to the execution plan due to missing or outdated statistics or even indexes. I recommend that you check out the following article for more details:
HOW TO: Troubleshoot Application Performance Issues
HOW TO: Troubleshoot Application Performance with SQL Server
INF: Understanding and Resolving SQL Server 7.0 or 2000 Blocking Problems
INF: Troubleshooting Stored Procedure Recompilation
**__________________________________**
SQL Server MVP, Sr. DBA & industry expert.
-
Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.