← Back to Database and Storage

Change Data Capture for Real-Time Data

Change Data Capture from database logs to downstream streams and derived systems.

Database and StorageData StreamingData Synchronisation

Change Data Capture, usually shortened to CDC, is the practice of turning database changes into a stream of events that other systems can consume. Instead of polling whole tables repeatedly, CDC observes inserts, updates, and deletes near the source and emits those changes with ordering and metadata that downstream consumers can process.

Why CDC matters

Operational databases are often the first place where important state changes happen: orders are placed, balances change, subscriptions renew, users update profiles. Other systems also need that information, such as search indexes, analytics pipelines, caches, fraud detectors, and notification services.

Without CDC, teams often fall back to scheduled polling or application-level fan-out. Polling is wasteful and slow. Application fan-out couples the write path to many downstream concerns. CDC provides a cleaner boundary by letting the database change log act as the source of truth for downstream propagation.

How CDC is commonly implemented

The strongest CDC systems read from database logs such as write-ahead logs or binary logs. This is preferable to triggers for many workloads because log-based capture sees committed changes in order and avoids injecting extra work into the transaction path. Triggers can still be useful in narrower cases, but they are easier to misuse and harder to scale.

A typical CDC pipeline also needs an initial snapshot. Downstream systems cannot apply ongoing changes correctly unless they first have a baseline view of existing data. Coordinating snapshot state with live change streams is one of the more subtle parts of a reliable CDC design.

What downstream consumers must handle

CDC is not just a firehose of rows. Consumers need to handle duplicates, ordering guarantees, schema evolution, deletes, and idempotent application. If the sink is a search index or analytics table, replay semantics should be safe. If the sink powers user-visible behaviour, lag and partial failure need explicit treatment.

The stream also reflects database reality, not business interpretation. A single business action may produce several row changes. Consumers should understand whether they are reading low-level mutations or domain-level events.

Failure modes to plan for

Lag is the most common operational issue. If downstream consumers fall behind, the system may remain correct but no longer feel real time. Schema changes are another hazard. Adding or renaming columns in the source database can break consumers that assume a fixed payload shape. Connector restarts, log retention windows, and snapshot interruptions also need planning.

Where CDC fits best

CDC is strongest when many downstream systems need to react to transactional data without burdening the write path. It enables near-real-time analytics, search synchronisation, audit feeds, and event-driven integrations. It is less useful when the source data itself is poorly modelled or when downstream teams expect business-level meaning that raw row changes do not provide.

Used well, CDC turns the database from an isolated persistence layer into a reliable event source. The key is treating it as a data movement contract with ordering, replay, and schema responsibilities, not just as a convenient feed of changed rows.