.NET Architecture & System Design Interview Question #86

What is CQRS from a system-design perspective?

Transactions, CQRS, Event Sourcing & Distributed Consistency Mid-Level Intermediate

Quick Interview Answer

CQRS separates operations that change state from operations that read state. The write and read sides can use different models, logic, or even data stores when their requirements differ significantly.

Detailed Explanation

CQRS separates operations that change state from operations that read state. The write and read sides can use different models, logic, or even data stores when their requirements differ significantly.

CQRS does not require separate databases, messaging, or Event Sourcing. It should be introduced when the separation provides real value, because independent read and write paths increase architectural and operational complexity.

Code Example

Commands -> Write Model -> Write Store

Queries  -> Read Model  -> Read Store

Stores may be the same or different.