← Back to Technical Guides
Duczer East Guides: Change data capture explained, methods, tools and pitfalls
AI & Data Engineering

Change data capture explained: methods, tools and pitfalls

How to stream database changes to warehouses, lakehouses and AI systems
Guide AI & Data Engineering 8 min read October 30, 2026 Duczer East Insights
Part of the Insights topic: Private AI & Data Architecture →

Change data capture (CDC) is a way of recording every insert, update and delete in a database as it happens, and delivering those changes to other systems. Instead of copying whole tables on a schedule, CDC sends only what changed, usually within seconds. It is how data warehouses, lakehouses, search indexes, caches, microservices and AI systems stay current with the operational databases they depend on. This guide covers the four ways to capture changes, the main tools, a working setup, and the problems that show up in production. It is part of our Private AI & Data Architecture series.

The four CDC methods, from most to least common in new builds:

  1. Log-based: read changes from the database's transaction log.
  2. Trigger-based: database triggers write each change to a side table.
  3. Query-based: poll tables for rows with a newer timestamp or version.
  4. Snapshot comparison: copy whole tables and compare them with the last copy.

What change data capture is

Every operational database already knows what changed. It records each committed insert, update and delete in a transaction log so it can recover after a crash. Change data capture turns that record, or something like it, into a stream of change events that other systems can consume.

A change event usually carries the operation (create, update or delete), the row's key, the values before and after the change, the time it was committed, and its position in the log. Consumers apply those events in order to keep their own copy in step with the source.

The alternative is batch extraction: copying tables every night, or every hour. Batch is simpler, but it is slow, it loads the source heavily at extraction time, and it misses intermediate changes. A row updated three times between extracts appears once. A row inserted and deleted between extracts never appears at all.

Four ways to capture changes

Log-basedTrigger-basedQuery-basedSnapshot comparison
How it worksReads the database transaction logTriggers write changes to a side tablePolls for rows with a newer timestamp or versionCompares full copies of a table
Load on the sourceLowAdds work to every writeRepeated queriesHigh at each run
Captures deletesYesYesNo, unless rows are soft-deletedYes, by difference
Captures every changeYesYesNo, only the latest state at each pollNo
LatencySecondsSecondsPolling intervalBatch interval
Schema changes neededNone, but log settings may changeTriggers and side tablesA reliable timestamp or version columnNone
Typical useDefault for new buildsOlder databases without log accessSimple cases, small tablesSmall reference tables, reconciliation

Log-based CDC is the default for good reasons. It adds little load, because the database writes the log anyway. It captures deletes and every intermediate change. It preserves the order in which changes were committed. And it needs no changes to application tables.

The other methods still have a place. Trigger-based CDC works where you cannot get log access, such as some managed or vendor-hosted databases. Query-based CDC is fine for small tables where missing an intermediate change does not matter. Snapshot comparison is useful for reconciliation: checking that a CDC pipeline has not drifted from the source.

Change data capture tools compared

These are common choices, not a ranking.

ToolTypeTypical sourcesDelivers toFit
DebeziumOpen-source, log-basedPostgreSQL, MySQL, SQL Server, Oracle, Db2, MongoDB and othersKafka through Kafka Connect, or other targets through Debezium ServerKafka-centered estates that want open source
Database-native CDCBuilt into the databaseSQL Server CDC, PostgreSQL logical decoding, MySQL binary logChange tables or a replication streamA starting point that other tools read from
IBM Data ReplicationCommercialDb2 for z/OS, IMS, VSAM, plus Db2, Oracle, SQL Server and othersKafka, warehouses, filesMainframe and core systems
Oracle GoldenGateCommercialOracle and other databasesDatabases, Kafka, cloud targetsOracle-heavy estates
Qlik ReplicateCommercialMany relational and mainframe sourcesWarehouses, lakes, KafkaBroad source coverage with a graphical console
AWS Database Migration ServiceManaged serviceCommon relational databasesAWS targets, Kafka on Amazon MSKAWS migrations and ongoing replication
ClouderaDebezium connectors in Kafka Connect and in SQL Stream BuilderDb2, MySQL, Oracle, PostgreSQL, SQL ServerKafka, Flink, lakehouse tablesCDC inside a Cloudera data platform

On Cloudera, the Debezium source connectors run in Kafka Connect and write changes to Kafka topics, and SQL Stream Builder can read the same databases directly through Flink without Kafka in between. Both keep CDC inside the same governed platform as the data it feeds, alongside Kafka and Flink on Cloudera.

How to set up log-based CDC

The steps below use PostgreSQL and SQL Server as the sources and Debezium with Kafka Connect as the capture tool. The same sequence applies to other databases and tools.

Step 1: Choose the tables and confirm their keys

List the tables that consumers actually need. Every captured table should have a primary key, because the key decides how changes are ordered and how consumers apply them. Tables without a key produce changes that are hard to apply correctly downstream.

Step 2: Prepare the database

Each database exposes changes differently. PostgreSQL needs logical decoding turned on and a publication that names the tables. SQL Server needs CDC enabled on the database and on each table, with SQL Server Agent running.

sql
-- PostgreSQL: set wal_level = logical in postgresql.conf, then restart
CREATE PUBLICATION orders_publication
  FOR TABLE public.orders, public.order_lines;

-- SQL Server: enable CDC for the database, then for each table
EXEC sys.sp_cdc_enable_db;
EXEC sys.sp_cdc_enable_table
  @source_schema = N'dbo',
  @source_name   = N'Orders',
  @role_name     = NULL;

Create a dedicated database user for capture with only the privileges it needs, and store its password in a secrets store, not in the connector configuration.

Step 3: Configure the connector

The connector reads the log and writes one Kafka topic per table. This is a minimal Debezium configuration for the PostgreSQL source, submitted to Kafka Connect:

json
{
  "name": "orders-postgres-cdc",
  "config": {
    "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
    "database.hostname": "orders-db.internal",
    "database.port": "5432",
    "database.user": "cdc_reader",
    "database.password": "${file:/secrets/cdc.properties:password}",
    "database.dbname": "orders",
    "topic.prefix": "orders",
    "plugin.name": "pgoutput",
    "slot.name": "orders_cdc",
    "publication.name": "orders_publication",
    "table.include.list": "public.orders,public.order_lines",
    "snapshot.mode": "initial"
  }
}

Changes to public.orders arrive on the topic orders.public.orders. The password is read from a file at runtime, so it never sits in the configuration itself.

Step 4: Run the initial snapshot

A new connector first copies the current contents of each table, then switches to streaming changes from the log position it recorded at the start. For large tables, schedule the snapshot for a quiet period, or use an incremental snapshot so it runs in chunks alongside streaming.

Step 5: Plan for schema changes

Columns get added, renamed and dropped. Register change event schemas in a schema registry, set compatibility rules, and agree with application teams how schema changes are announced. A renamed column that reaches consumers unannounced is the most common cause of a broken pipeline.

Step 6: Monitor lag and log retention

Watch how far the connector is behind the source, and how much log the database is holding for it. Alert on both. A connector that stops is not just late: on some databases it causes the log to grow until the disk fills.

Common pitfalls in production

CDC for analytics and AI

CDC is how analytical and AI systems get current data without loading the systems of record. Changes stream into lakehouse tables, such as Apache Iceberg tables, so analytics runs on data minutes old instead of a day old. Feature stores stay current for machine learning models. Retrieval systems re-index documents and records when they change, so an AI assistant does not answer from a superseded version.

Every one of those uses raises the same question from reviewers: where did this data come from, and when? A CDC pipeline is a lineage source in its own right. Record which source tables feed which topics and tables downstream, as part of your data lineage.

If you work in a regulated industry

Banks and insurers often hold their most important data on mainframes: Db2 for z/OS, IMS and VSAM files behind core banking, policy and claims systems. These are the sources where CDC delivers the most value and needs the most care. Commercial tools such as IBM Data Replication read these sources and can deliver to Kafka, so modern platforms can use mainframe data without changing the core system.

Three controls matter more in regulated settings. Mask or exclude personal and account data at capture time, so it does not spread to every consumer. Treat the CDC pipeline as part of the system of record for lineage and reconciliation, with regular checks that the target matches the source. And put connector configuration, credentials and table lists under change control, with an audit trail of who changed what.

When to bring in a partner

Turning on CDC for one table takes an afternoon. Running it across core systems, with snapshots, schema changes, masking, monitoring and reconciliation, is a production system in its own right. Duczer East designs and runs Debezium CDC on Cloudera and on other platforms, from mainframe and relational sources into Kafka, lakehouse tables and AI systems.

Frequently asked questions

What is change data capture?

Change data capture is a way of recording every insert, update and delete in a database as it happens and delivering those changes to other systems. It replaces full table copies with a stream of changes, usually within seconds of each commit.

What is log-based change data capture?

Log-based CDC reads changes from the database's transaction log rather than querying the tables. It adds little load to the source, captures deletes and every intermediate change, and keeps changes in commit order, which is why it is the default for new builds.

Is change data capture the same as ETL?

No. ETL extracts, transforms and loads data, usually in scheduled batches. CDC is a way of extracting only what changed, continuously. Many modern pipelines use CDC as the extract step and then transform the changes in a stream processor or in the target.

Does change data capture slow down the source database?

Log-based CDC adds little load, because the database already writes its transaction log. The main risk is not speed but storage: if the capture process stops, some databases keep log files until it catches up, and the disk can fill.

What is the difference between change data capture and database replication?

Database replication copies a database to another instance of the same database, mainly for availability and failover. Change data capture delivers the changes as events that different systems can use, such as Kafka, a lakehouse, a search index or another type of database.

Can you use change data capture on a mainframe?

Yes. Commercial tools such as IBM Data Replication capture changes from Db2 for z/OS, IMS and VSAM and can deliver them to Kafka and other targets. This lets modern platforms use mainframe data without changing the core system.

Would you like to discuss CDC for your operational databases?

Duczer East designs Debezium CDC on Cloudera and other platforms, covering log-based capture, schema evolution, masking, reconciliation and lineage from relational and mainframe sources.

Prefer email? info@duceast.com
Duczer East — Where Data Engineering Meets Agentic AI

The Practitioner's Briefing

Senior-level insights on agentic AI, data engineering, and enterprise integration — delivered to your inbox.