.NET Architecture & System Design Interview Question #87
When are separate read and write databases useful in CQRS?
Transactions, CQRS, Event Sourcing & Distributed Consistency Mid-Level Intermediate
Quick Interview Answer
Separate stores can be useful when read and write workloads have very different scaling, schema, performance, or technology requirements. A read model can be denormalized and optimized for queries while the write model protects transactional rules.
Detailed Explanation
Separate stores can be useful when read and write workloads have very different scaling, schema, performance, or technology requirements. A read model can be denormalized and optimized for queries while the write model protects transactional rules.
The trade-off is synchronization and eventual consistency. The system must define how changes reach the read store and how users experience propagation delay.
Code Example
Command -> Write DB
|
event/change
v
Read DB
^
|
Query