Question

Hope ya all doing good and safe:-

I am collecting query level metrics from extended events using below events for -

SP statement completed
SQL Statement completed
SQL Batch Completed
RPC Completed

I have seen sometimes similar queries collecting in many events which look similar. I am not able to understand why exactly? Can someone explain exactly whats the major difference between these 4 events. This is just for my dev servers as a test to see what i am collecting.Is there an event for one fit all?

Was it helpful?

Solution

Can someone explain exactly what's the major difference between these 4 events

SQL Batch Completed
RPC Completed

Clients submit batches of SQL Statements using a "SQL Batch" or an "RPC". These events track those client requests. SQL Batches can also be sumbitted by sp_executesql or exec (@sql) from other batches or a stored procedure.

SQL Statement completed

Each SQL Batch will contain zero or more "SQL Statements". This event tracks the execution of those statements.

SP statement completed

A SQL Statement or an RPC can invoke a Stored Procedure which in turn has multiple statements inside it. When a stored procedure runs you get a "SP Statement Completed" event for each statement in the stored proedure.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top