Distributed

Lesson 03.12

CQRS & event sourcing

Event sourcing stores every change as an event in an append-only log, and CQRS builds separate read models from that log for fast queries.

The book is the truth

The shop keeps a money book 📒: every coin in or out is a new line, and old lines are never changed. A screen shows the total, worked out from the book by Ben.

One day the screen breaks. The book is fine. How does Ben get the total back?

In this lesson you'll

  1. 1Explain how keeping every change lets you rebuild a screen, and how a saved total saves time
  2. 2Watch Ben add up the whole book again.
  3. 3Guess how saved totals change that.
  4. 4Get the total back quickly.