CQRS

Also known as: Command Query Responsibility Segregation

framework · computer science · organizing-schema

Separates read and write models for scalability and clarity.

Command Query Responsibility Segregation, articulated by Greg Young around 2010 and building on Bertrand Meyer's earlier Command-Query Separation principle (which applied at the method level — methods either return values or change state, not both), separates the data model used for commands (state-changing operations) from the data model used for queries (read-only operations) at the architectural level. The two models can have different schemas, different storage, different consistency characteristics, and different scaling profiles, with synchronization between them typically asynchronous via events. CQRS is often paired with Event Sourcing (commands produce events, events update both the write store and the read store) but the two are independent — CQRS can use a traditional database for the write side, and Event Sourcing can be used without separate read models. CQRS adds substantial complexity and is typically appropriate only when read and write workloads have substantially different requirements (e.g., complex reporting against simple writes, or vice versa).

Originators

Greg Young (CQRS articulation); Bertrand Meyer (Command-Query Separation precursor); Udi Dahan (related work) high

Year / Decade

Bertrand Meyer's CQS late 1980s; Greg Young's CQRS articulation around 2010 high

Primary sources

Young, G. (2010). 'CQRS Documents' (multiple online publications), Meyer, B. (1988). Object-Oriented Software Construction (CQS precursor), Fowler, M. (2011). 'CQRS' (martinfowler.com) high

Core components

Primary use case

Systems with substantially different read and write requirements; reporting and analytics against transactional sources; complex domain models needing separate read denormalization; integration with Event Sourcing for audit and replay; financial and regulated systems where write integrity matters and read patterns vary; foundation for some microservices patterns.

Common criticisms

Lineage

Siblings
Event-Driven Architecture, Event Sourcing, Domain-Driven Design