DataIntermediate

When would you actually use CQRS?

“A team wants to introduce CQRS for their SaaS product. What problem must exist for that to be a good decision, and what will it cost them?”

What this tests

  • CQRS as a response to a measured mismatch between read and write shapes
  • The cost: eventual consistency between models, projections, two models to maintain
  • CQRS-lite as the usual right answer
  • Read-after-write handling in the UI

Answers by level

Read the beginner answer first and notice what is missing.

CQRS pays off when the write model and the read model genuinely want different shapes: writes are normalised and validated per aggregate, while the dashboard needs a denormalised view joining eight tables, or reads outnumber writes 100:1 and need a different store (Elasticsearch, a Redis projection). Without that mismatch, it is two models to keep in sync for no gain.

The cost is eventual consistency: a command updates the write model, an event updates the read model some milliseconds to seconds later, and a UI that reads its own write immediately sees stale data. You also inherit projection rebuilds, schema evolution across two models, and a new failure mode ("the projector is 20 minutes behind"). Most teams should start with CQRS-lite: separate read queries and DTOs against the same database, no async projection — see CQRS.

Green flags · Red flags

Strong green flag · Describes how the UI shows the user their own change before the projection catches up.
Green flags
  • Demands a measured read/write mismatch before adopting it
  • Names eventual consistency and projection lag as the price
  • Recommends CQRS-lite (separate queries, same DB) as the first step
  • Has a read-your-writes strategy
  • Separates CQRS from event sourcing
Red flags
  • "CQRS is a best practice for scalable systems, so we should use it from day one."
  • Assumes CQRS implies event sourcing
  • No answer for read-after-write staleness
  • Cannot say what a projection rebuild costs

Follow-up questions

F1
A user saves a profile and the list page still shows the old name. What do you do?
F2
The projector falls 30 minutes behind after a deploy. Impact and fix?
F3
What is CQRS-lite concretely?

Scenario

A B2B invoicing product has a reporting page that joins invoices, line items, customers, payments and tax rules; p99 is 3.8 s against a 500 ms SLO and the query has already been indexed and tuned. Writes are 200/day. The team proposes CQRS with a separate read database. Assess whether the problem justifies it and what the read-side design should be.

Learn this topic