During an extended events session with histogram as target, sometimes you can see unexpected results. Some events may not appear at the same time when other events’ count show a higher value than they should.
This is a side effect of the histogram target design. It uses a hashing function to aggregate entities into buckets. Therefore, depending on the selection of the aggregation field, two objects may be stored in the same bucket, and they will both be shown under the name of the one executed first.
This can occur even when you use the NO_EVENT_LOSS parameter. Assume the following
You set up an Extended Events session, using histogram as target and grouping by object_id, to collect stored procedures execution.
Then, you execute Stored Procedure A.
Then, you execute Stored Procedure B.
If both Stored Procedures object_id return the same value for the hash function, histogram will show Stored Procedure A being executed two times, and Stored Procedure B will not appear.
For more information about Histogram target, go to the following page: