Some clarifications about the "MaximumPageSize" parameter in the event history request

Hello team.

I have a curiosity, why the MaximumPageSize parameter in the event history fetch requests does not imply that the number of events returned is at most that amount?

Running tests, if I specify a MaximunPageSize of 1, I get pages of 1, 2 or 3 events. If for example, I set 100, I get 183 or 185.

Maybe this parameter refers to an internal page size and when the query is made, a flattening is done and a number of events greater or equal to the requested page size are returned. It is a hypothesis, but be that as it may, the parameter is a bit confusing.


Temporal optimizes DB writes by batching multiple history events into a single blob. The current pagination code is very simplistic and cannot count the exact number of events returned, as the number of DB records doesn’t correspond to the number of events. In the future, we will try to improve that.

Thanks as always Maxim, I understand perfectly :wink: