The SQL Server Batches Received (Per Second) metric counts the number of T-SQL batches that SQL Server receives for execution every second. This value is measured by reading 'batch requests/sec' from
sysperfinfo. While this counter has no good or bad value, each of these T-SQL batches must:
- Be transmitted to the server using the network.
- Be parsed by SQL Server to check syntax.
- Include a compiled execution plan.
- Include an executed execution plan.
- Transmit the results back to the client computer or Web.
You must minimize the number and reduce the impact of these T-SQL batches as much as possible by:
- Reducing the size and complexity of the T-SQL by creating a stored procedure containing the commands you want executed, and then simply calling it in the T-SQL batch. This action reduces the size and complexity of the T-SQL batch, resulting in less network traffic and CPU time consumed producing a complex execution plan.
- Grouping as many calling T-SQL commands into a single network batch after you move most of the T-SQL code into stored procedures. Redesign the application to call whatever stored procedures you need to complete an application function all from within one batch rather than sending each EXECUTE statement to execute separately in its own batch. This action dramatically reduces network queues as you make better use of the default network packet size of 4 KB.