Command Query Responsibility Segregation (CQRS) Pattern

Learn the Command Query Responsibility Segregation design pattern and its usage.


This pattern decouples read from write operations to allow them to evolve independently. CQRS is also known as Read versus Write Services or the Command Query Separation pattern.

Context and problem

Quite often, services that deal with persistence are designed to provide CRUD operations. Regardless of the transport mechanism or technology, a service would have one data model and provide, create, read, update, and delete operations for that model. The operations can then be easily mapped to a REST-style interaction, and, for example, the persistence can be implemented with very little coding using an ORMObject-Relational Mapping tool such as Hibernate.

Get hands-on with 1200+ tech skills courses.