Command Query Responsibility Segregation separates reads from writes:
Commands: Write operations. Validate, process, emit events.
Queries: Read operations. Optimized read models. Denormalized for fast access.
Why separate?
- Different scaling needs. Reads often x writes.
- Different optimization strategies.
- Read models can be eventually consistent.
Common pairing: Event sourcing for writes, materialized views for reads. Events update the read models asynchronously.
Adds complexity. Use when read and write patterns diverge greatly.