|
How to Narrow Down Your Performance Problem First determine the source of the problem. It is often just a handful of queries that make the whole system seem slow. Run Performance Monitor, SQL Profiler, and the blocking script to capture what is occurring when you encounter the problem. It is important that they are run at the same time so that you can cross-reference the information. These logs must be started BEFORE the problem occurs in order to capture the information about what leads up to the problem. SQL Profiler SQL 7.0
SQL 2000
Blocking
Performance Monitor (PerfMon or SysMon)
Analyze your logs SQL Profiler Look at your Profiler output. Generally you can sort by duration and find the longest running queries to concentrate on. If the file is extremely large or you want to do complex queries against it, open the saved log and save it as a table. Note that you don't want to save the file directly to a table while tracing as this can cause performance problems. Take the long running queries and run them from Query Analyzer with these settings: SET STATISTICS PROFILE ON Check for table or clustered index scans, warnings such as missing
statistics, etc. Check your blocker script output for 'head of chain' spids. If you find any, check to see if they are long lasting. Some short term blocking is normal in your system. If the blocking lasts more than a couple of seconds then use the spids to match with the spids in Profiler to find out which query was executed to hold the blocking lock. Use this information to find the source of the problem. Performance Monitor (PerfMon) In most cases you can ignore spikes in the counters. If you see high values in a particular counter at a certain time, see if the counter is being influenced by SQL Server or by outside factors such as backup software, virus scanners, etc. If it is definitely tied to SQL Server, you can match the time span for the counter to queries executed in Profiler during that timeframe and work on tuning them. Implement Changes Test your changes on a representative test system. This means similar hardware, configuration, data, statistics, etc. Then schedule a rollout on your production system. Create new logs to track the improvement made by implementing the changes. Use these logs, along with documentation regarding data size, system load, etc., as a new baseline for future performance comparisons. SQL Server Directory How to Troubleshoot a
Performance Problem |
Page last updated: 04/14/02 |