ENES

Change data capture

Copying every insert, update and delete from a database to other systems as it happens.

A database writes every change to its log; a CDC reader follows the log and streams insert, update and delete events to a warehouse and a search index

Change data capture, or CDC, is a technique for detecting each change made to a database and sending it elsewhere, almost in real time. Instead of copying a whole table every night, CDC sends only what changed: a new order inserted, a price updated, a customer deleted, each as a small event.

The most common method reads the database's own transaction log. Databases like PostgreSQL and MySQL already write every change to a log before applying it, for crash recovery and replication. A CDC tool such as Debezium or AWS Database Migration Service tails that log and turns each entry into an event, usually published to a stream. Older approaches use triggers or poll for rows with a recent updated_at, but they add load and can miss deletes.

CDC is how a data warehouse stays minutes behind the production database instead of a day, how a search index or a cache stays in sync with the source of truth, and how a database can be migrated with almost no downtime. The tricky parts are order, since events must be applied in the sequence they happened, schema changes in the source, and the first full copy that has to be taken before streaming changes on top of it.

Keep in mind

Go deeper

Related terms

More in Data