0

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?

1 Answer 1

1

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.

2
  • 1
    thanks for the explanation. But i am more curious for how i can avoid duplicate calls in those 4 events as sometime same queries seems to be getting captured from all. it might be not worth collecting so many duplicate calls Commented Apr 30, 2020 at 19:39
  • @BeginnerDBA, if you are interested in calls rather than individual statements, just capture sql_batch_completed and rpc_completed.The others provide statement level detail.
    – Dan Guzman
    Commented Apr 30, 2020 at 22:04

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.