Data Integration Updated: 2026-01-21

What is Change Data Capture (CDC)?

A technique for identifying and capturing changes made to data in a database, enabling real-time or near-real-time data replication to other systems.

From the field

Change Data Capture (CDC) is the trick that makes "near-real-time" data warehousing feasible. Instead of re-scanning a 500M-row transactional table every hour to find what changed — slow, expensive, and guaranteed to miss deletes — you tap into the database's transaction log (Postgres WAL, MySQL binlog, SQL Server CDC tables, Oracle redo logs) and stream each committed change as an event. The source database barely notices; the destination gets updates within seconds; deletes are captured exactly.

Three flavors, one winner

Log-based CDC reads the transaction log directly and is the one you want for production. Trigger-based CDC uses database triggers to write to a change table — works on any database but adds write overhead to the source, and triggers get disabled or diverged during schema changes. Timestamp-based "CDC" queries for WHERE updated_at > last_checkpoint — technically not CDC, misses deletes entirely, and breaks whenever someone forgets to update updated_at on a hot path. If a vendor pitches you CDC, ask whether it's log-based. If not, it's not really CDC.

Field story

A retail client had a 200M-row Postgres orders table and was doing a nightly "full refresh" to Snowflake — a 4-hour job that locked out analytics every night and still missed same-day updates. We switched to Debezium → Kafka → Snowpipe Streaming, reading the Postgres WAL. End-to-end lag dropped to <30 seconds, source database load dropped ~80%, and the nightly job disappeared. Two operational lessons the hard way: (1) the Postgres replication slot can fill the WAL disk if the consumer lags — we learned this during an outage when Snowpipe Streaming had backpressure and WAL grew 400GB in six hours; (2) schema changes need coordination — an ALTER TABLE on Postgres while the connector is running can orphan state. Plan a "pause CDC / apply schema change / resume CDC" runbook.

Change Data Capture (CDC) is a technique that identifies and captures changes (inserts, updates, deletes) made to data in a database. Instead of copying entire tables, CDC streams only the changes, enabling efficient real-time data replication.

Why CDC Matters

Traditional batch extraction is inefficient:

  • Full loads: Copy entire tables repeatedly
  • Timestamp-based: Misses deletes, requires modification tracking
  • Performance impact: Heavy queries on source systems
CDC solves these issues by capturing changes at the source.

CDC Methods

  1. Log-Based CDC: Read database transaction logs (most efficient)
  2. Trigger-Based CDC: Database triggers capture changes
  3. Timestamp-Based: Query for recently modified rows (not true CDC)
  4. Diff-Based: Compare snapshots (resource intensive)

Log-Based CDC Flow

Source DB → Transaction Log → CDC Tool → Target System
(MySQL,      (binlog, WAL)    (Debezium)   (Kafka, DW)
 Postgres)

Popular CDC Tools

ToolTypeBest For
DebeziumOpen SourceKafka integration
FivetranManagedEasy setup
AirbyteOpen SourceSelf-hosted
AWS DMSCloudAWS ecosystems
StriimEnterpriseComplex transforms

CDC Use Cases

  • Data Warehousing: Near-real-time warehouse updates
  • Microservices: Sync data between services
  • Event Sourcing: Capture all state changes
  • Cache Invalidation: Update caches on data change
  • Search Indexing: Keep Elasticsearch in sync

Key Points

Gotchas

CDC is powerful and sharp. Common pitfalls:

  • Replication slots on Postgres can take down the source. If the consumer (Debezium, Fivetran, Airbyte) lags, the WAL can't be truncated and the disk fills. Set alerts on pg_replication_slots.restart_lsn lag and have a runbook for dropping orphaned slots fast.
  • Schema changes are not handled uniformly. Some CDC tools auto-propagate ALTER TABLE; some pause; some fail silently. Before you ALTER a CDC'd table, read your tool's schema-change behavior and test in staging. Always coordinate schema changes with the CDC pipeline.
  • MySQL binlog format must be ROW, not STATEMENT. STATEMENT replication doesn't give you before-and-after row states. Set binlog_format=ROW and binlog_row_image=FULL. This needs a MySQL restart on older versions.
  • Deletes aren't free. Some destinations (Snowflake via Snowpipe Streaming) support native CDC semantics (apply inserts/updates/deletes to target). Others (plain S3 + Iceberg) require merge logic in your pipeline. Verify your destination's handling before assuming your warehouse reflects source reality.
  • Initial snapshot can lock the source. The initial "snapshot" phase (bulk copy before streaming changes) can hold long-running queries or locks on large tables. Use snapshot with chunking, or snapshot from a read replica, or use "snapshot.mode=schema_only" and backfill separately.
  • Ordering guarantees are per-partition/per-key. Kafka + Debezium gives you per-key ordering; across keys, events may interleave. Downstream consumers that assume global ordering will get surprising behavior. Design for per-key ordering only.
  • At-least-once delivery means duplicates are possible. Idempotent downstream processing is required. Primary keys + MERGE INTO on the destination handle this well; blind appends don't.
  • Heartbeats matter on low-traffic tables. If a CDC'd database is idle, some tools stop advancing the replication position and eventually fall behind when traffic resumes. Enable heartbeat events (Debezium supports this) to keep position current.

Frequently Asked Questions

What is Change Data Capture (CDC) in simple terms?

CDC is a technique for capturing every change (insert, update, delete) made to a database and streaming those changes to other systems, usually within seconds. Instead of re-scanning whole tables periodically, CDC taps into the database's internal transaction log (Postgres WAL, MySQL binlog, etc.) to emit a change event for every committed row. It's how modern data platforms keep warehouses, search indexes, caches, and downstream services in near-real-time sync with source databases without hammering the source with repeated full scans.

Why is CDC better than batch extraction?

Four reasons: (1) efficiency — only changed rows move, rather than re-scanning entire tables; (2) latency — sub-minute freshness vs. hourly or daily batch; (3) completeness — captures deletes, which timestamp-based batch misses; (4) source impact — reading the transaction log is much lighter than repeated table scans. The tradeoff is operational complexity: replication slots to manage, schema-change coordination, and idempotent downstream processing. For tables with low change rates, batch is still simpler; for high-velocity tables, CDC typically wins on both cost and freshness.

What is Debezium?

Debezium is the leading open-source CDC platform. It runs as a set of Kafka Connect connectors that read transaction logs from Postgres, MySQL, MongoDB, SQL Server, Oracle, and Cassandra, and emit change events to Apache Kafka (or directly via the Debezium Engine API). It's the engine behind most CDC implementations you'll encounter — Airbyte uses Debezium internally for database CDC; Confluent Platform bundles it; Fivetran uses similar log-reading approaches. For teams already running Kafka, Debezium is the default; for teams without Kafka, managed tools like Fivetran or AWS DMS remove the operational burden.

What is log-based CDC?

Log-based CDC reads the database's internal transaction log (Postgres Write-Ahead Log, MySQL binlog, SQL Server's native CDC tables, Oracle redo logs) to capture every committed change. It's the most efficient and complete CDC method because (a) the transaction log already has every change the database committed; (b) reading it doesn't add query load on the source; (c) it captures deletes, which query-based methods miss. The alternatives — trigger-based CDC and timestamp-based polling — are fallbacks when log access isn't available.

What are the best CDC tools in 2026?

Managed / SaaS: Fivetran (polished, expensive on high-churn), AWS DMS (good for AWS-native stacks), Striim (enterprise features), Oracle GoldenGate (for Oracle-heavy environments). Open-source: Debezium (the standard, deploys via Kafka Connect or standalone engine), Airbyte (uses Debezium under the hood for DB sources). Cloud-native: Snowflake's own Snowpipe Streaming with Kafka Connect sink, Google Datastream, Azure Data Factory. Choose based on destination — Kafka ecosystem → Debezium; Snowflake-first → Snowpipe Streaming + Debezium or Fivetran; AWS-heavy → DMS.

What are common pitfalls when running CDC in production?

Five I've seen repeatedly: (1) runaway replication slots filling WAL disk and taking down Postgres — set slot-lag alerts; (2) MySQL binlog in STATEMENT format instead of ROW — CDC will miss before/after states; (3) schema changes breaking the pipeline — coordinate ALTER TABLE with your CDC tool; (4) initial snapshot locking up large tables — use chunked snapshots or snapshot from a read replica; (5) forgetting to handle duplicates — CDC is typically at-least-once, so downstream MERGE or idempotent writes are required. Plan for all five before turning on CDC in production.

What's the difference between CDC and data replication?

CDC is a technique for capturing changes; data replication is the broader goal of keeping two data stores in sync. CDC is one mechanism for replication, but replication can also be done with batch diffs, full table copies, or vendor-native features (Snowflake replication, Oracle Data Guard). Modern replication almost always uses CDC under the hood because it's more efficient. Practically, when someone says "I want real-time replication from Postgres to Snowflake," they mean CDC. The terminology is loose; the mechanics are log-reading + streaming + destination writes.

Related Terms

FivetranApache KafkaAirbyteETL (Extract, Transform, Load)Stream Processing

Related Tools

DebeziumFivetranAirbyteAWS DMSKafka

Learn More

Related Articles

Browse All Terms Read Articles