Introduction
PostgreSQL 19 came out on November 19, 2026, and it dropped a common setup step. Older versions often needed a server restart before logical replication could start. Since the PostgreSQL 19 announcement, the server raises the WAL level to logical when the first logical replication slot is created.
Logical replication is how most tools run change data capture on PostgreSQL. So, what is change data capture? Change data capture (CDC) copies only the rows that changed in a database, as inserts, updates, and deletes, instead of reloading whole tables.
This article explains how CDC works, the four ways to capture changes, and when CDC is worth the extra work.
What is Change Data Capture?
Change data capture is a set of techniques that detect row-level changes in a source database and deliver them to other systems. Each change travels as an event that records an insert, an update, or a delete. Downstream systems apply the events in order and stay in step with the source.
CDC is one of several data movement methods, and the data integration techniques guide shows where it sits among them. CDC moves records but doesn’t match or clean them.
The data integration guide covers the wider practice around CDC. Matching and cleaning records belong there.
Why CDC Matters: Fresh Data Without Full Reloads
CDC matters because the source ships only its changed rows, so each copy stays close to live. A full reload reads every row on every run, even when only a small share changed. Each run strains the source database.
Table growth makes the reload slower over time. Log-based CDC’s work grows only with the number of changes.
Beyond load, a reload hides what happened between runs. A row that changed twice in one day lands only in its final state. Log-based and trigger-based CDC send each committed change as its own event, so a target that stores them keeps the full history.
This event stream can feed a warehouse, a search index, and an operational app at once. The teams behind each system read the same events instead of building separate extract jobs.

How Change Data Capture Works
Change data capture works as a loop of capture and apply. A capture process detects each committed change in the source and writes it out as an event. An apply process at the target repeats each change in commit order. Most production tools capture from the database’s transaction log.
Reading the Transaction Log
The transaction log is the usual source for CDC because every database already writes it. A database records each change in the log before it updates the table. PostgreSQL calls it the write-ahead log (WAL), MySQL the binary log, and Oracle the redo log.
Each log entry has a position, called a log sequence number (LSN) in PostgreSQL. After a crash, a CDC tool resumes from the last position it stored.
Snapshot First, Then Stream
A new CDC pipeline starts with a snapshot because the log rarely holds a table’s full history. Databases recycle old log files, so the oldest rows predate the earliest entry still on disk. The tool copies the current tables once and notes the log position at that moment. Streaming then starts from the noted position.
The handoff must not drop or reorder changes. Debezium and Google Cloud Datastream both manage the handoff. Both can still resend an event, so the target must ignore duplicates.

Push vs Pull
Push and pull describe which side starts the transfer. In a push setup, a capture agent sends events to the target or a message broker as they happen. In a pull setup, the target asks the source for new changes on a schedule. Push gives lower delay, while pull is simpler to run and pause.
Change Data Capture Example: One Order, Three Events
A change data capture example makes the event format concrete. Take a hypothetical order 1001 through a normal week. The customer places it, and the warehouse ships it. A cleanup job later deletes the row.
The table shows the three events a log-based tool would send for order 1001 on a PostgreSQL table set to REPLICA IDENTITY FULL.
|
Event |
Operation |
Before |
After |
Log Position |
|---|---|---|---|---|
|
Order Placed |
Insert |
None |
status = new, total = $120 |
0/16B3748 |
|
Order Shipped |
Update |
status = new |
status = shipped |
0/16B39A0 |
|
Row Deleted |
Delete |
status = shipped |
None |
0/16B3C10 |
Each event carries the row before and after the change, so the target can apply updates and deletes without querying the source. With the default setting, PostgreSQL sends only the key columns as the before values.
Four CDC Methods Compared
The four CDC methods differ in where they find each change. Two read changes as they happen, from the log or from triggers. The other two compare data after the fact, by polling a timestamp column or by diffing full snapshots. The choice trades delay and source load against setup effort.
The table below compares the four methods on what they catch and what they cost the source database.
|
Method |
Catches Deletes |
Load on Source |
Typical Delay |
Choose It When |
|---|---|---|---|---|
|
Log-Based |
Yes |
Low |
Seconds |
Log access is allowed and a CDC tool fits |
|
Trigger-Based |
Yes |
High on every write |
Seconds |
Triggers are allowed but the log is not |
|
Query-Based |
Only flagged deletes |
Medium, on each poll |
Minutes |
Tables carry a reliable updated_at column |
|
Snapshot Diff |
Yes |
Very high |
Hours |
Only full exports exist, such as vendor files |
Log-based CDC matches the best result in every column, and its main cost, setup effort, sits outside the table.
Log-Based CDC
Log-based CDC reads committed changes straight from the database’s transaction log. The tables themselves are never queried, so the load on the source stays low. Deletes and the order of changes come through exactly as the database recorded them. The cost is setup, because log access needs extra permissions and settings.

Trigger-Based CDC
Trigger-based CDC uses database triggers to write each change into a separate change table. The trigger fires inside the same transaction as the write, so the change table never misses one. Every write now does double work, though, which slows busy tables. Triggers suit sources where the log is out of reach.

Timestamp or Query-Based CDC
Query-based CDC polls each table for rows whose timestamp or version column moved past the last value read. The method needs no special access, so it’s often the first version a team builds. It can’t see hard deletes, because a deleted row leaves no timestamp behind.

Snapshot Diff
Snapshot diff finds changes by comparing a full copy of a table with the previous copy. The method works on any source that can export data, including a vendor’s flat file. It reads every row on every run, so it suits small tables only.

CDC by Database
CDC setup differs by database, because each engine exposes its log in its own way. Some engines ship a built-in feature, while others rely on outside tools. The table below compares four common databases.
|
Database |
Change Source |
How to Switch It On |
Main Catch |
|---|---|---|---|
|
PostgreSQL |
WAL through logical decoding |
wal_level = logical, then a replication slot |
Idle slots keep WAL on disk |
|
SQL Server |
Transaction log, copied to change tables |
sys.sp_cdc_enable_db, then sys.sp_cdc_enable_table |
Needs SQL Server Agent running |
|
MySQL |
Binary log in row format |
binlog_format = ROW, binlog_row_image = FULL |
Expired binlogs strand a stalled reader |
|
Oracle |
Redo log |
ARCHIVELOG mode and supplemental logging |
LogMiner tuning or a GoldenGate license |
Only SQL Server ships change tables, while the others hand the log to an outside reader.
PostgreSQL: Logical Replication and WAL
Postgres change data capture runs on logical replication, which decodes the write-ahead log into row changes. A publication lists the tables to share, and a replication slot tracks how far each reader has gone. The built-in pgoutput plugin turns WAL records into change events that tools such as Debezium read.
Version 19 also replicates sequence values. Amazon RDS and Cloud SQL gate logical replication behind their own parameters, and the PostgreSQL logical replication docs cover the rest.
SQL Server
SQL Server change data capture is built in, and it copies changes from the transaction log into change tables. An administrator enables it once for the database and then for each table. SQL Server Agent jobs capture new changes and clean up old rows.
The SQL Server CDC documentation sets the default retention at three days, so a reader that falls further behind loses data. A column added to the source later is ignored, and capturing it takes a second capture instance.
MySQL and Oracle
MySQL and Oracle both support log-based CDC, though neither offers change tables like SQL Server’s. MySQL 8.0 and later write row-based binary logs by default, so setup is mostly permissions and binlog retention. Oracle change data capture reads the redo log through LogMiner (Oracle’s built-in log reader) or through Oracle GoldenGate, the company’s own replication product.
Change Data Capture Use Cases
Change data capture use cases share one need, a copy that must stay current without slowing the source. The five below run from analytics to compliance. Each reads the same event stream differently.
Real-Time Analytics
Real-time analytics is a common reason teams add CDC. Real-time data replication puts events in a warehouse or streaming engine within seconds of each commit. A fraud team can then review a suspicious payment during checkout.
Data Replication to a Warehouse
Data replication to a warehouse keeps an analytics copy of operational tables off the production database. CDC applies each change to the warehouse as a merge. The copy matches the source.
Analytics on an operational database gets costly at scale. Scout’s data platform migration, a one-off move rather than CDC, shifted 200M+ consumer records from PostgreSQL to Snowflake and OpenSearch. Long-running jobs dropped from 84 hours to two hours.
Zero-Downtime Migration
Zero-downtime migration uses CDC to keep a new database in step with the old one while the application keeps running. The team loads a snapshot into the target and streams changes until the two match. The application then switches over in a short window.
The same pattern handles major PostgreSQL upgrades. The Snowflake migration guide covers the cutover checks for a warehouse move.
Syncing Operational Systems
Syncing operational systems means sending a change in one app’s database to other apps that need it. A new order event can refresh a search index or alert a shipping service. An outbox table keeps consumers away from raw table changes. The app writes clean business events there, and CDC publishes them.
SaaS tools rarely expose a database log, so webhooks fill the same role there. Data Prism’s real-time data integration work runs on webhooks and event-driven pipelines. Kaemark’s order and task status now syncs around the clock.
Audit History
Audit history is a side benefit of CDC, because every event records what changed and when. Stored in order, the events show any row’s state at any past moment. Finance teams use this trail to check when a price changed.
Change Data Capture Tools: Open Source and Managed
Change data capture tools split into open-source engines a team runs and managed services a vendor runs. Open source costs less in licenses and more in engineering time. Managed tools charge by volume or by connector and take on monitoring and upgrades.
The tools below cover most production setups.
- Debezium, an open-source engine that runs on Kafka Connect or alone
- AWS Database Migration Service, for ongoing replication into AWS
- Google Cloud Datastream, a serverless service that feeds BigQuery
- Oracle GoldenGate, Oracle’s replication product for mixed databases
- Qlik Replicate, a log-based tool with a graphical setup
- Fivetran, Airbyte, and Estuary, which run CDC as managed connectors
Airbyte also has an open-source edition. The pipeline tools roundup compares wider pipeline platforms by category.
CDC vs Batch ETL: Cost and Complexity
CDC costs more to run than batch ETL, even though it moves less data. A nightly batch job fails loudly and reruns cleanly. A CDC pipeline runs all day, so it needs lag alerts and someone on call.
The table compares the two on the factors that drive running cost.
|
Factor |
Batch ETL |
CDC |
|---|---|---|
|
Data Freshness |
Hours to a day |
Seconds to minutes |
|
Load on Source |
Heavy during each run |
Low and steady |
|
Deletes |
Missed by append-only jobs |
Sent as events |
|
Recovery |
Rerun the job |
Resume from the log position |
CDC buys freshness and a lighter source load. Operations work is the price of both. CDC usually feeds ELT, where raw changes land in the warehouse before any modeling, a pattern the ETL vs ELT guide compares with ETL.
When Batch or Webhooks Are Enough
Batch or webhooks are enough when nobody acts on the data faster than the batch delivers it. A finance report read each morning gains nothing from live updates. CDC earns its cost when someone acts within minutes.
CDC is worth the extra work when any of these hold.
- A decision depends on data less than an hour old
- Full reloads no longer fit their time window
- The target must reflect deletes as well as new rows
- A migration must finish without stopping the application
Common CDC Problems
Common CDC problems come from changes outside normal row writes. Schema changes, deletes, ordering, backfills, and log growth cause most broken pipelines. Each has a known fix that belongs in the design before launch.
Schema changes are a frequent break point, because PostgreSQL logical replication doesn’t carry them. A column added on the source needs a matching target column first.
Deletes are the second break point. Append-only targets miss them, so the target needs a merge step.
Ordering breaks when one row’s events arrive out of sequence. Kafka keeps each row’s events in order when the topic (a named event stream) is partitioned by primary key.
Backfills can collide with the live stream. Debezium’s incremental snapshots reload a table in chunks while streaming continues.
Log growth is the problem most likely to hurt the source. An idle PostgreSQL replication slot keeps every WAL file after its position until the disk fills. A max_slot_wal_keep_size limit protects the disk, though a slot past the limit is invalidated and needs a fresh snapshot.

Is Change Data Capture Worth It?
Change data capture is worth it when a decision or a migration can’t wait for the next batch. For daily reports from a few tables, a scheduled load is cheaper. For live analytics and cutovers without downtime, log-based CDC is the standard choice.
Everything above assumes the source database can take the new settings. A design review of slot monitoring, retention, and the backfill plan before go-live is part of Data Prism’s data integration services.
Book a Free 30-Minute Meeting
Discover how our services can support your goals — no strings attached. Schedule your free 30-minute consultation today and let's explore the possibilities.
Book a Free Call

