How are the events stored for each aggregate?

Hi Allard,

When using event sourcing in Axon framework, how does the framework store these events for each aggregate?

I’m interested in a MySql event store. Let’s say we have 3 aggregates Customer, Supplier and Order.

Are the events from the 3 aggregates stored in a single table? or does each aggregate hold its events in a different table?


the JPA Event Store stores all events in a single table. The event data and meta data are stored as Blob columns. The other columns will store the aggregate identifier, aggregate type, timestamp, sequence number, etc. The Event Type will indicate what type of aggregate the identifier belongs to, and is by default the simple class name of your aggregate (e.g. Customer, Supplier or Order).

Hope this helps.


That’s great. Now what happens when that table grows gigantically?

some of our applications produce about 20 million events per hour. I can see that table growing to an unreasonable size. Won’t loading and saving the aggregates be affected by the tables size?

You’re most likely best of configuring sharding. The aggregate identifier is usually a good sharding key, as all “regular” operations on the event store always use an aggregate id. That would allow you to spread operational load over the shards.

An alternative (or something to consider in combination with sharding) is an archiving solution. For one of our clients, I have built an event store implementation that appends events as a stream in files. During normal operations, the archive is never used. The operational database would contain all events relevant to reconstruct aggregate state. Only when replaying historic data, you will need access to the archive.

Work is being done on an event store implementation that can easily handle this type of volume. It will be commercially licensed to provide a more large-scale alternative to the implementations already available in Axon. If you’re interested in such implementation, let me know and I’ll send you some information.



Sure thing Allard I could really use the extra info.

I’d like that information as well.