Q45: What is CQRS, and when should it be used?

Difficulty:AdvancedTopic:Architecture

Command Query Responsibility Segregation separates the model used to change state from the model used to read it. It can optimize complex read workloads with denormalized projections and independent scaling, but projections may lag and operational complexity increases. CQRS is useful when read and write models differ materially; it is unnecessary overhead for straightforward CRUD applications.

Key Takeaways
  • CQRS separates write commands from read queries.
  • Use it when independent models solve a real problem, not by default.