Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. What is event sourcing?

Batch & Streaming · Streaming Processing

What is event sourcing?

Mediumstream-25
event sourcingauditreplayevents

Question

What is event sourcing?

Solution

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).

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.

PreviousNext