Varying Event Durations Can Point to Compilation Problems

Generally speaking, the difference between a SQL:BatchCompleted event's duration time and a SQL:StmtCompleted event's duration time is how long each event takes to parse and compile a query.

Brian Moran

November 22, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today

When I use SQL Server Profiler to track performance problems, I sometimes notice large differences—as much as 2 or 3 seconds—between the duration for the SQL:BatchCompleted event and the SQL:StmtCompleted event. Why are the duration times different?

Generally speaking, the difference between a SQL:BatchCompleted event's duration time and a SQL:StmtCompleted event's duration time is how long each event takes to parse and compile a query. SQL Server can usually parse and compile a batch quickly. However, sometimes a batch is complicated or other stresses on the system cause the compilation time to become a significant part of the time it takes SQL Server to run a query. So, large differences between the duration of SQL:BatchCompleted and SQL:StmtCompleted events can point to queries that have compilation problems.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like