Difference between SQL:BatchStarting and SP:StmtStarting

Hi All,

I am trying to troubleshoot a potential performance issue for one of our applications and I can't understand what is happening from SQL Profiler.

I am capturing the queries when I am running an action in the application and notice that several 'batches' take > 5 seconds but the 'stmt' inside the batch is very fast.

Both TextData output is the same

Notice:

BatchStarting starts at 14:17:06 and finishes at 14:17:12 - total of 6 seconds

StmtStarting starts at 14:17:12 and ends at 14:17:12 - so the same query seems fast..?

Can someone make sense of this or is there another column/event I should add?

Thanks in advance

August 20th, 2015 2:37pm

That indicates that it takes some time for the batch to start executing. Usually, this is compilation, but it can also be things like setting up table variables. (Although, if that takes six seconds, that's quite excessive.)

Free Windows Admin Tool Kit Click here and download it now
August 20th, 2015 5:31pm

A batch is a group of one or more Transact-SQL statements sent at the same time from an application to SQL Server for execution. SQL Server compiles the statements of a batch into a single executable unit, called an execution plan. The statements in the execution plan are then executed one at a time.

Batches

August 21st, 2015 1:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics