Command Query Responsibility Segregation (CQRS)

Learn about how the command query responsibility segregation pattern works.

In this last lesson of the chapter, we will discuss a popular architectural pattern for distributed systems: the command query responsibility segregation (CQRS) pattern.

What is CQRS?

The name pretty much gives away the meaning.

In CQRS, read and write paths are separated, and possibly there are separate databases that handle read and write requests.

Command means requests like create, insert, update or delete. On the other hand, query means read requests. In read requests, no data is changed in any way. Data is served to clients as a response to queries. In CQRS, the read and the write path are segregated. Written data is made available for reading using some sort of special mechanism.

Get hands-on with 1200+ tech skills courses.