Batch & Streaming · Streaming Processing

What is event sourcing?

Mediumevent sourcingauditreplayevents

Interview question

What is event sourcing?

How to answer

The short answer

Event sourcing stores the history of state-changing events as the source of truth, not only the latest row. Current state is a projection rebuilt by replaying events (or maintained incrementally).

Output
Classic row store:     orders table has latest status = SHIPPED

Event sourced:
  OrderCreated
  PaymentCaptured
  OrderShipped     --> replay --> current Order view

Pros

  • Full audit trail
  • Rebuild read models differently later
  • Natural fit with Kafka-style logs

Cons

  • Harder queries on raw events
  • Schema evolution of events
  • Snapshots needed so replay is not from day zero every time

Interview tip: Contrast with "upsert the latest row." Event sourcing = "append facts, derive state." Mention it often pairs with CQRS.