Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append to stream is limited to 7,281 events #77

Closed
slashdotdash opened this issue Oct 27, 2017 · 0 comments
Closed

Append to stream is limited to 7,281 events #77

slashdotdash opened this issue Oct 27, 2017 · 0 comments
Labels

Comments

@slashdotdash
Copy link
Member

Events are appended to a stream using a single INSERT statement. This is to ensure they are inserted with contiguous event ids and for performance reasons. Each event uses nine parameters, and there are an additional three parameters for event id, stream id and stream version. PostgreSQL can support a maximum of 65,535 parameters in a single query. Therefore you are limited to 7,281 events in a single INSERT statement (7,281 * 9 + 3 = 65,532).

Attempting to insert too many events results in the following error:

Postgrex.Protocol (#PID<0.17104.79>) disconnected: ** (RuntimeError) postgresql protocol can not handle 104268 parameters, the maximum is 65535

The events should be inserted in batches (e.g. 1,000 events at a time) within a single database transaction to ensure they are contiguous. This would allow an unlimited number of events to be atomically appended to a single stream in one request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant