Free Newsletters:
DatabaseJournal  
DBANews
Database Journal
Search Database Journal:
 
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum DBA Videos
internet.com

» Database Journal Home
» Database News
» DBA Videos
» Database Articles
» Database Tutorials
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» DBA Jobs
» Sitemap

News Via RSS Feed



follow us on Twitter

Marketplace Partners
Be a Marketplace Partner

internet.commerce
Be a Commerce Partner


















Apple: 1M New iPhones Sold, Apologies for Snafus

T-Mobile's Next Android Phone: myTouch 3G

Firms Push Cloud, Virtualization for IT Niches

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Database Journal | DBA Support | SQLCourse | SQLCourse2







Solumina Developer
The Computer Merchant, Ltd
US-CT-East Hartford

Justtechjobs.com Post A Job | Post A Resume
May 12, 2003

Identifying Stored Procedure Recompilation Problems in SQL Server 2000

By Andrew Novick

Tools to Monitor Recompiles

There are two tools available from Microsoft to monitor recompiles: Windows Performance Monitor and SQL Server Profiler. Windows Performance Monitor, or PerfMon, monitors compiles and recompiles in the aggregate. It is a good tool to use when you are determining the overall frequency of recompiles.

SQL Server Profiler gives you a detailed picture of the stored procedures that are executing and shows you exactly where recompiles are occurring. However, it can produce voluminous output and must be used carefully.

Using PerfMon to Gather Aggregate Recompile Statistics

The Perfmon video

When SQL Server is installed, it adds its own performance counters to PerfMon. If you install multiple instances of SQL Server on the same computer, each instance has its own counters. The most interesting counters to watch when monitoring recompiles are in the Performance object named "SQL Server:SQL Statistics". The counters to monitor are "SQL Compilations/sec" and "SQL Re-Compilations/sec." Figure 1 shows PerfMon's Add Counter dialog box as "SQL Re-Compilations/sec" is added to the list of running counters.

Figure 1 Adding SQL Re-Compilations/sec to PerfMon

Once the counters are added to PerfMon's current list, monitoring begins. In order to generate enough recompile events, I'm going to use this script to generate one hundred invocations of usp_Recompiles_SeveralTimes.

DECLARE @i int, @rc int
SET @i = 1
WHILE @I <= 100 BEGIN
    EXEC @RC = usp_Recompiles_Due2Index  
    SET @I = @I + 1
END

When I run the script the counts of compiles and recompiles in PerfMon spike near the 100/second mark. Figure 2 shows PerfMon after I ran the script 3 consecutive times.

Figure 2 PerfMon showing 100s of Recompiles

The lines for SQL Compilations/sec and SQL Re-compilations/sec are running on top of each other. Compilations include recompilations but also count initial compiles when the procedure is inserted into the cache.

PerfMon shows only aggregate numbers. To get a more detailed look at the performance numbers the SQL Profiler is the best tool around.

Go to page: Prev  1  2  3  4  Next  

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed








Latest Forum Threads
Database Journal Home Forum
Topic By Replies Updated
Spacing between Detail and Header in Report tigers 2 June 23rd, 09:23 AM
why this sp dont work rodrigo 3 June 23rd, 08:54 AM
Linked Server sowmyav 6 June 23rd, 05:42 AM
Set up classic ASP-db in VISTA Frank 0 June 22nd, 09:34 PM