What to choose for Read Side - Event Sourcing - CQRS

Hi Team,

We are building a new project based on the Axon Framework. We have used the Postgresql data source for Read and Write . I am not sure if we are doing the right thing , we had a lot of discussion on using the Elastic Search for read side, there were few discussion which came out saying we are disturbing the whole f/w pattern were keeping the same data source for read and write. So I am not a subject matter expert please guide me on what to choose and what not to. So as a head start the application is a web application and read side will be used mainly by UI and later point of time we have to expose the same data to other clients through services.

Please reply to this thread because it will be helpful for the whole process.


Hi Samrat,

Axon, or CQRS in general, doesn’t mandate anything about using a different (physical) storage for read and write. The logical separation of the two allows you to make choose the best type of storage of each command and query model (you can -and usually do- have multiple models on each side) for the use case.

On the query side, it’s completely irrelevant what you chose for the command side. If your view models require you to search for information, then an Elastic instance will be much more appropriate. If your view model is relational in nature, then pick a relational database. If it’s about relationships, use a graph database. Etc.

If you use event sourcing, you’re usually best off using a built-for-purpose event store, such as AxonServer. You mentioned Postgres, which works fine initially but will suffer performance degradation as your event store grows in size. AxonServer doesn’t have that performance degradation, and will also allow you to transparently scale your command and query models out, without any need to (re)configuration of messaging.

Basically, CQRS in general, and Axon more specifically, allows you to optimize each model independently, which makes it extremely powerful and suitable for complex applications.

Hope this helps.