Share via

In Extended Events data differs in SQL_batch_completed & sql_statement_completed

Deepak Rane (drane) 60 Reputation points
2023-10-20T07:25:56.76+00:00

Hi Team,

I have extracted Extended Events data in XEL file.

I have observed one difference that

SQL_batch_completed Logic_reads value is different than SQL_ stament_completed.

Event in the batch only one SQL is present which I matched in SQL Statement Completed.

Some records Logical Reads value is greater in SQL_batch_completed and in some records the value for logical reads in SQL_ stament_completed greater.

This difference is with others as well like CPU, durations etc.

Why such a difference?

@Dan Guzman

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories


1 answer

Sort by: Most helpful
  1. AI answer

    2023-10-20T07:25:56.7633333+00:00

    The difference in Logical Reads values between SQL_batch_completed and SQL_statement_completed events in Extended Events can occur due to the way SQL Server processes batches and statements. SQL_batch_completed event is raised when a batch of Transact-SQL statements completes, whereas SQL_statement_completed event is raised when a single Transact-SQL statement completes. It is possible that a batch of statements may contain multiple individual statements that are executed separately and may have different logical reads values. Therefore, it is expected to see differences in the Logical Reads values between these two events.

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.