I often read that one great advantage of CQRS is having denormalized data on the read-side. E.g. one can store data fields and child objects redundant to avoid joins. But that also means a single event might result in multiple update operations on the read-side, as a state change to an entity must be reflected in multiple read-side places.
Doesn't that imply you need atomic transaction support on the read-side? Many NoSQL databases only support transactions within one collection or one partition.
How do CQRS-based systems deal with that in real life?
- Do they use SQL databases on the read-side?
- Do they use non-redundant data only? Then, why having a read-store in the first place?
- Are there fancy database technologies supporting atomic transactions in the cloud?
No, not necessarily but you need to protect against concurrent updates.
In my latest project I use MongoDB for most of my read-models. This database has no transaction support but I don't need one because I use optimistic locking. I wrote an article here about this, with an example in PHP. The idea is that I detect concurrent updates by using a version (as an unique index) and retry the last one.
I use full data denormalization. That means that I have in one document all the information I need for a particular view.