← Lessons

quiz vs the machine

Gold1380

Databases

Change Data Capture

Streaming every insert update and delete to downstream systems.

5 min read · core · beat Gold to climb

What CDC Solves

Other systems often need to react when a database changes, for example to update a search index or a cache. Polling the table is slow and misses fast updates. Change data capture (CDC) emits a stream of every insert, update, and delete as it happens.

How It Works

  • The most reliable approach reads the database write ahead log, the same record used for crash recovery.
  • Each committed change becomes an event with the old and new row values.
  • Events flow into a message queue like Kafka for consumers to process.

Why Log Based CDC Wins

  • It captures every change in commit order with no gaps.
  • It adds little load because it tails an existing log instead of querying tables.
  • Consumers can rebuild downstream state by replaying the stream.

Key idea

Change data capture turns committed database changes into an ordered event stream, usually by reading the write ahead log, so downstream systems stay in sync without polling.

Check yourself

Answer to earn rating on the learn ladder.

1. The most reliable source for log based CDC is:

2. A key advantage of CDC over polling is: