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
Table partitioning for event table #2979
Comments
Hey @williancolognesitrimble, thanks for making this issue with us! Concerning your suggestion, I am afraid it may take an approach that's only feasible for Event Streaming. When it's about Aggregates for Event Sourcing, you wouldn't know the date to jump back to. Furthermore, you only suggest something for JDBC, leaving out JPA support entirely (the second RDBMS-based Event Store pillar in AF). Lastly, I want to react to your "Possible Workarounds" sentence:
Although building yourself is indeed an option, a workaround with a lot (and I really mean a lot) less work, is to use a purpose-built Event Store solution. With all that said, I've changed the type from "Enhancement" to "Feature", as I would argue table partitioning support is a feature rather than an enhancement. I hope that clarifies our stance further, @williancolognesitrimble! |
Sounds good, agreed. Just a few clarifications: Considering this, I'm not 100% familiar with axon structure, but I believe we could use
|
That makes sense @williancolognesitrimble! I'll guide a little further about the infrastructure components of Axon Framework. When it comes to Event Streaming, which is arguably the "query side" of the application when talking in CQRS terms, you will hit the following infra components:
It is the event streaming area I am worrying about the least, as you indeed have the When it comes to EventSourcing, which from AF's perspective is the "command side" in CQRS terms, the following in infra components come into play:
Whenever an Aggregate is loaded from the events it has published, the query done to the To put it in context, the It's this pointer that complicates the suggestion, as the API used to query a stream of events for Event Sourcing has no notion of time.
Sure thing! I just wanted to make sure the suggestion wasn't lost :-)
That's awesome, thanks! |
That's nice, thank you so much for the explanation @smcvb |
Enhancement Description
We understand that the number of events will continue to grow indefinitely, and sometimes there's a need to retain these events for extended periods. However, as time progresses, querying this database using JDBC event store may lead to degraded performance. To address this challenge, we can leverage table partitioning.
By utilizing table partitioning, we can optimize performance, even with a historical database. This involves partitioning tables based on the datetime of events, allowing for partitioning by month, week, or even day, depending on the specific use case. Consequently, queries, such as those executed in
JdbcEventStorageEngineStatements
, should be modified to utilizedatetime
togetheraggregateIdentifier
.Current Behaviour
Currently it's only possible to optimize this table by using index or using partitioning by aggregateIdentifier that would not be enough depending on the size of your table.
Wanted Behaviour
Includes event datetime in all queries that are executed in jdbc to be able to define which partition table the database should scan.
Possible Workarounds
There are no workarounds without implementing this AFAIK.
The text was updated successfully, but these errors were encountered: