0

I'm looking into some performance metrics and every recommendation includes monitoring Batch Requests/sec. But, maybe a silly question, does a singe batch request correspond to exactly one tsql statement? Say it contains exactly one select or one update, etc. So, for example, a stored procedure with 3 selects and 2 inserts triggers 5 batch requests. Or, as I think, a batch request can include for example a full stored procedure, a function, several select/update/insert statements, etc.

All I can find is similar to these descriptions:

  • TechNet Number of Transact-SQL command batches received per second. This statistic is affected by all constraints (such as I/O, number of users, cache size, complexity of requests, and so on). High batch requests mean good throughput.
  • Understanding how SQL Server executes a query Batch Request This request type contains just T-SQL text for a batch to be executed. This type of requests do not have parameters, but obviously the T-SQL batch itself can contain local variables declarations. This is the type of request SqlClient sends if you invoke any of the SqlCommand.ExecuteReader(), ExecuteNonQuery(), ExecuteScalar(), ExecuteXmlReader() (or they respective asyncronous equivalents) on a SqlCommand object with an empty Parameters list. If you monitor with SQL Profiler you will see an SQL:BatchStarting Event Class
5
  • 1
    Take a look here: technet.microsoft.com/en-us/library/… But to answer - no it's not automatically a single statement. Apr 29, 2014 at 9:49
  • Just what I was looking for. Post your comment as answer and you will get your hard earned reputation points ;)
    – Yaroslav
    Apr 29, 2014 at 9:51
  • 1
    It's basically a link answer - so not much to post as answer without duplicating the content from the link :) Apr 29, 2014 at 9:51
  • Correct. But you can add some of the text, not just the link, in case it breaks in the future.
    – Yaroslav
    Apr 29, 2014 at 9:53
  • Done as requested :) Apr 29, 2014 at 10:24

1 Answer 1

1

As per the comment, then no - it's not a single statement. A batch can cover multiple individual T-SQL statements in a single batch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.