CDC, Domain Events, and the Meaning of Change

By Arshad Ansari

A database update and a business occurrence are different things. Most pipeline confusion comes from treating them as the same.

This is the next piece in a series on data modeling and meaning. Earlier posts covered domain-driven design, ontologies and data contracts. This one is about change.

A row changed. What happened?

Take an order row. Its status goes from pending to cancelled.

The database knows one fact: a value changed. It does not know why. Did the customer cancel? Did payment fail? Did support cancel it by hand? Did a cleanup job fix a duplicate?

Four different business occurrences can produce the same update. Each one may need a different reaction downstream. A refund runs for one. A fraud review runs for another. Nothing runs for the cleanup job.

The update is a record of storage. The occurrence is a record of meaning.

Three tools, three questions

Change data capture (CDC) reads the database log and tells you what changed in storage. It answers: what did the table look like before and after this write? It is accurate, complete and close to the source. It carries no business intent.

Domain events are statements the application makes on purpose: OrderCancelledByCustomer, PaymentFailed. They answer: what happened, and why? They carry intent. They exist only if someone designs and emits them.

Snapshots are the full state at a point in time. They answer: what was true at that moment? They are easy to reason about and easy to check. They hide everything that happened between two snapshots.

None of these replaces the others. Each one fails in a way the others cover.

Where each one breaks

  • CDC alone gives you a perfect log of writes and no reasons. Analysts end up guessing intent from column diffs. Those guesses become hidden business rules in SQL.
  • Events alone depend on the application emitting them every time. A code path that forgets to emit leaves a silent gap. Nothing in the event stream tells you it is missing.
  • Snapshots alone lose the path. If an order was cancelled and reinstated between two snapshots, you never see it.

How they coexist

A layout I use often:

  1. CDC is the ground truth for storage. Capture every change from the source database. Keep it raw and append-only.
  2. Domain events carry meaning. The application emits events at the points where the business cares. Each event names the occurrence and its cause.
  3. Snapshots are the check. Take a regular full state. Rebuild state from CDC and compare it with the snapshot. Compare events with CDC: every event should line up with a change, and every important change should have an event.

The last step is the useful one. A change with no matching event is a finding. It means a code path writes to the table without saying why. That is often a manual fix, a script or a legacy job. You want to see it.

The pipeline then has clear jobs. Reports about current state read the snapshot layer. Reports about behaviour read events. Audit and recovery read the CDC log.

Name the occurrence in the model

This ties back to the series. If the model has a word for "order cancelled by customer" and a different word for "order cancelled by the system", the event names follow naturally. If the model only has a status column, every consumer will invent its own meaning.

An event name is part of the data contract. Treat it like a column type: define it, version it and test it.

When you do not need all three

A small team with one source database and simple reporting can start with snapshots and CDC. Add domain events when a downstream process has to react to a reason, not a value. Do not build an event system to feed a single dashboard.

This approach is not for a team that cannot yet say what its core business events are. Settle the vocabulary first. The tooling comes after.

Check your own pipeline

If you are not sure where your pipeline stands, the free Data Platform Teardown is a checklist you can run yourself. It needs no call and no sign-up.

Common questions

Is change data capture the same as event sourcing?
No. CDC records that a row changed. Event sourcing records that something happened in the business, and builds state from those records. CDC can feed an event model, but it does not give you one.
Do I need domain events if I already have CDC?
Only if someone downstream needs to know why a row changed. If all they need is the current state or the history of values, CDC and snapshots are enough.
Can snapshots and CDC run together?
Yes. Snapshots give you a known state at a point in time. CDC gives you what changed since. Together they let you rebuild and check each other.

Get new posts by email

Data engineering notes like this one — what breaks and what it costs, in production.

What breaks and what it costs — pipelines, warehouse bills, and the failures that only show up in production. A few a month, never padded to hit a schedule. No sequence, no pitch deck. Reply 'stop' once and you're off — it reaches me, not a queue.

Want the whole playbook?

If this was useful, the long version is my book. Local-First Analytics — 313 pages, runnable code for every chapter — is the full build: DuckDB, Parquet and Arrow, from install to production. On Amazon, and chapter 1 is free to read here.

Not ready to buy? Read chapter 1 free — the whole chapter, no email required.

Rather talk it through? Book a free 30-minute call. No slot that suits your time zone? Email info@hikmahtech.in.