CQRS
CQRS separates read and write operations into distinct models—the read side optimizes queries, the write side optimizes validation—often paired with event sourcing.
Purpose
Separate reads from writes to optimize each side's performance and scalability.
Mechanism
Commands (writes) and queries (reads) use different models/data stores. The write model enforces business rules; the read model optimizes queries (materialized views/search indexes). Read stores can be heterogeneous (Elasticsearch/Redis). Eventually consistent.
Use cases
- Read/write separation
- Performance optimization
- Event sourcing