Change Data Capture: How It Works, Patterns and Architecture
Change data capture explained: how CDC reads database changes, the four main patterns, a reference architecture, Debezium basics and the pitfalls to plan for.

Change data capture (CDC) is a way of finding out what changed in a database (every insert, update and delete) and passing only those changes to other systems, instead of copying whole tables again and again. Databricks describes it as treating a database as a stream of changes rather than a static snapshot. Each change record carries the operation type, the data values and a sequence number or timestamp so the order can be replayed correctly. This guide covers how CDC works, which pattern to pick, what a working architecture looks like, how Debezium fits in, and where projects usually go wrong.
TL;DR
- CDC captures inserts, updates and deletes from a source database and delivers them to other systems in near real time, so you stop reloading full tables.
- Four patterns exist: log-based, trigger-based, query-based (timestamp) and snapshot comparison. Log-based is the usual choice for production systems.
- A typical pipeline has a source connector, a buffer such as a streaming platform, and a destination connector.
- Plan for schema changes, the initial snapshot, log retention and duplicate events before you go live.
- CDC tells you what changed. Slowly changing dimensions (SCD) decide how the warehouse stores that history.
Table of Contents
- What change data capture does
- How CDC works under the hood
- CDC patterns and their trade-offs
- CDC architecture: the moving parts
- CDC with Debezium
- CDC, full refresh and slowly changing dimensions
- What to plan for before you go live
- A practical checklist
- Building CDC into your own platform
- FAQ
- Sources
What change data capture does
Most businesses have data in one place that other systems need: orders in a transactional database that the finance dashboard, search index, CRM and analytics warehouse all depend on. The traditional fix is a nightly batch that copies everything. It is slow, it loads the source database hard, and everything downstream is a day behind.
CDC replaces that with a feed of changes. AWS calls it a data synchronization pattern that sends inserts, updates and deletes to other systems in near real time, saving bandwidth and time while keeping systems consistent.
The practical gains are easy to see:
- Fresher data. A new order shows up in reporting in seconds or minutes, not tomorrow.
- Lighter load. You move the rows that changed, not millions that did not.
- Complete history. Deletes and intermediate updates can be captured, which a nightly snapshot misses.
- Decoupled systems. Services subscribe to changes instead of querying the source database directly.
How CDC works under the hood
Every serious database already records its own changes so it can recover after a crash. PostgreSQL calls this the write-ahead log, MySQL the binlog, SQL Server the transaction log. CDC reads that record, turns each entry into an event and ships it on.

SQL Server has this built in. Microsoft Learn documents that it uses SQL Server Agent to log insertions, updates and deletions into change tables that mirror the columns of the tracked source tables, with the transaction log as the source of the change data.
A single change event usually contains:
- The operation: insert, update or delete.
- The new row values, and often the previous values for updates and deletes.
- A position marker, such as a log sequence number or timestamp, that fixes the order.
- Metadata such as the table, schema and transaction.
That position marker matters more than it looks. Consumers use it to resume after a failure without skipping or repeating work.
CDC patterns and their trade-offs
There is more than one way to detect a change. Each makes a different trade between source impact, completeness and effort.
Log-based CDC
The connector reads the database log directly. OneUptime's implementation guide describes it as the most efficient and reliable approach: no impact on application queries, deletes captured, transaction order kept and no schema changes needed. The cost is setup. You need database configuration changes, appropriate permissions and managed log retention.
Trigger-based CDC
Database triggers write each change into a separate table. Redpanda's guide notes that it is simple to implement but hurts write performance when there are many triggers, and creating triggers needs a schema change that is not always acceptable.
Query-based (timestamp) CDC
A job periodically selects rows whose updated_at is newer than the last run. Domo explains this is lightweight and straightforward but typically cannot capture deletes and depends on clean timestamp data. It suits applications with predictable update patterns where real-time accuracy is not critical.
Snapshot comparison
The whole table is captured at intervals and compared with the previous copy. It works almost anywhere, but it is heavy on large tables and unsuited to real-time use. If a value changes three times between snapshots, you see only the last state.
Choosing between them
| Pattern | Captures deletes | Source impact | Latency | Schema change needed | Best for |
|---|---|---|---|---|---|
| Log-based | Yes | Minimal | Seconds or less | No | Production pipelines, event streaming |
| Trigger-based | Yes | Extra write overhead | Low | Yes (triggers, audit tables) | Databases without log access |
| Query-based | Not reliably | Repeated reads | Minutes or more | Often (timestamp column) | Small tables, simple reporting |
| Snapshot comparison | By comparison only | Heavy on large tables | Hours | No | Legacy systems, infrequent changes |
There is also a push versus pull distinction. Confluent describes push as the source sending updates downstream and pull as downstream services polling at fixed intervals. Triggers are push; timestamp queries are pull.
A rule of thumb we use: if you need deletes, ordering and low latency, go log-based. If you cannot touch the database configuration, a trigger or query approach is a compromise you should make knowingly.
CDC architecture: the moving parts
A CDC architecture is a short pipeline with a clear job at each stage. Redpanda's guide breaks a typical implementation into three components:
- Source connector. Reads changes from the database, by pushing or pulling.
- Data buffer. An in-memory queue or a distributed streaming platform. It absorbs spikes so a burst of writes does not overwhelm the destination.
- Destination connector. Subscribes to the buffer, applies any transformation and writes to the target: another database, file storage or a third-party API.
In practice the flow is: source database log, connector, stream, sink. The stream in the middle is what makes CDC useful beyond copying. One change feed can serve a warehouse, a search index, a cache and an AI feature at once, each as an independent consumer.
Where the data goes
- Analytics warehouse or lakehouse for reporting and machine learning features.
- Search index or cache, kept in step with the system of record.
- Other microservices, which react to events rather than polling an API.
- Audit and compliance stores, where a complete record of changes is the requirement.
If you are building the downstream side, our piece on the stages of an AI data pipeline covers what happens after the data lands.
CDC with Debezium
Debezium is the open-source project most teams meet first when they build log-based CDC. Per the Debezium tutorial, it is built on Apache Kafka and provides Kafka Connect compatible connectors. Each connector works with one database system, records data changes as they occur, and streams each change event to a Kafka topic that applications then read.
The connector documentation lists source connectors for MongoDB, MariaDB, MySQL, PostgreSQL, SQL Server, Oracle, Db2 and Cassandra, with further connectors for other systems, some still incubating. Check that page for the current list and each connector's status before you commit to a database.
A basic Debezium setup looks like this:
- Enable log access on the source (for example logical decoding on PostgreSQL or the binlog on MySQL) and create a database user with the required permissions.
- Run Kafka and Kafka Connect, then register the connector with its connection details and a topic prefix.
- The connector takes an initial snapshot, then switches to reading the log.
- Consumers read the change topics and write to the destination.
One point trips up teams. Debezium's job ends when events reach Kafka. Upsolver notes that data engineers still have to make sure the data arrives in the right format, on time and faithful to the source, and that processing is at-least-once by default. That is a design question for your consumers, not a flaw in the tool.
CDC, full refresh and slowly changing dimensions
Two comparisons come up constantly.
CDC versus a full refresh. A full refresh rebuilds the whole table each run. An incremental load processes rows changed since the last run, usually via a timestamp. CDC reads the change log and applies inserts, updates and deletes as they happened. Incremental loads miss hard deletes. Full refreshes are simple but get slower as data grows.
CDC versus SCD. They are not alternatives. Per Databricks, CDC captures changes in source systems, while SCD defines how those changes are managed and stored in warehouse dimension tables. Type 1 overwrites old values and keeps only the latest. Type 2 adds a new row for each change, preserving history with start and end timestamps. Most pipelines use both: CDC delivers the changes, then SCD logic stores them appropriately.
What to plan for before you go live
CDC is reliable when designed for, and painful when treated as plug and play. These are the issues we plan for first.
The initial snapshot
Before streaming begins, the destination needs the existing data. The connector takes a consistent snapshot and then continues from the matching log position. Size the snapshot window and the load it puts on the source.
Log retention
Streamkap's overview lists the pitfalls: schema changes that break some tools, the initial snapshot, and lost events if the consumer falls behind while the database rotates its log. Set retention longer than your worst realistic outage, and alert on consumer lag.
Schema changes
Adding or renaming a column changes the shape of every later event. Decide up front how downstream consumers cope: a schema registry, versioned contracts, or a transformation layer.
Duplicates and ordering
Most CDC pipelines deliver at-least-once, so a change can arrive twice. Build consumers to be idempotent, for example by merging on primary key and ignoring events older than the stored position. Reserve heavier exactly-once coordination for cases where duplicates would break an invariant, such as a financial ledger.
Latency expectations
Streamkap reports that most CDC pipelines deliver changes in 200 to 500 milliseconds. Treat vendor figures as a guide and measure your own end-to-end latency, since it depends on the network, the buffer and the destination write path.
Security and compliance
A change stream copies sensitive data to more places. Restrict who can read the topics, mask personal data before it leaves the source boundary where possible, and keep an audit trail of who accessed what. Australian organizations handling personal information should check how their obligations under the Privacy Act apply to every copy of the data, including streams.
A practical checklist
- List the consumers and how fresh each needs the data to be. Seconds, minutes or hours decide the pattern.
- Confirm you can read the database log and hold the permissions required.
- Decide how deletes should appear downstream: hard delete, soft delete or a history row.
- Pick delivery semantics and design idempotent consumers.
- Plan schema evolution and test it with a real column change.
- Monitor lag, log retention headroom and connector health from day one.
- Rehearse a rebuild: can you re-snapshot and catch up without downtime?
Our view on CDC
Most CDC projects we see go wrong for the same reason: the team treats the connector as the whole solution. The connector is the easy part. The hard part is everything around it: what happens when a schema changes on a Friday, when a consumer is down for six hours, or when someone asks for an audit trail of exactly who changed a record and when.
We build software with strict engineering standards, modular domain-driven architecture and zero-trust security, and we apply the same thinking to data movement. Define clear boundaries between the system of record and its consumers. Keep each consumer independent. Treat the change stream as sensitive data with its own access rules. Choose the simplest pattern that meets the freshness requirement, because complexity you do not need is a cost you carry for years.
This also reflects what we have learned from our own products. In document and e-signature workflows, a reliable record of every change is the product, not a side effect. That is the standard we bring to client pipelines, with AI used throughout our delivery process to move faster without cutting corners.
Josh
Building CDC into your own platform
If you are connecting operational systems to analytics, search or AI features, we design and build the whole path: source integration, streaming, destination services and the application on top. Our work covers custom software development, AI software development, cloud architecture and system integration for enterprises, SMBs, startups and agencies.

See our software and AI development services or talk to us through the LogicBranch site about a data pipeline that fits your systems and your compliance requirements.
FAQ
What is the difference between CDC and SCD?
CDC is the process of capturing changes from a source system. SCD is a modeling technique for storing those changes in warehouse dimension tables. Type 1 overwrites old values, while Type 2 keeps a new row for each change. Many pipelines use CDC to feed SCD Type 2 tables.
Which CDC pattern should I choose?
Choose log-based CDC when you need deletes, ordering and low latency, and you can access the database log. Choose timestamp queries for small, simple tables where hourly freshness is enough and deletes do not matter. Triggers fit cases where you cannot read the log but can change the schema.
Does CDC slow down my production database?
Log-based CDC reads a log the database already writes, so the impact on application queries is minimal. Trigger-based and query-based approaches add write overhead or repeated reads. Whatever the pattern, test with production-like volume before launch.
Is Debezium the only way to do CDC?
No. Some databases offer built-in CDC, such as SQL Server, and managed cloud services provide their own capture features. Debezium is a popular open-source option when you want log-based CDC streaming into Kafka across several database types.
Can CDC guarantee exactly-once delivery?
By default most CDC tools, including Debezium, deliver at-least-once. Exactly-once needs extra coordination between the stream and the consumer. Most teams get correct results by making consumers idempotent.
Sources
- Databricks: Change data capture and snapshots
- AWS: What is Change Data Capture?
- Microsoft Learn: What is change data capture (CDC)? SQL Server
- OneUptime: How to Implement Change Data Capture Pipelines
- Redpanda: CDC approaches, architectures and best practices
- Domo: CDC Replication
- Confluent: What Is Change Data Capture?
- Debezium: Tutorial
- Debezium: Source Connectors
- Upsolver: Debezium for CDC, Benefits and Pitfalls
- Streamkap: Database Replication Patterns
Recommended

API-First Design: What It Is and How to Apply It
API-first design means agreeing the API contract before building anything. See how it works, when it beats code-first, and how Australian businesses can use it.

Tokenization vs Encryption: How to Choose for Your Data
Tokenization and encryption protect data in different ways. Learn how each works, how they compare with masking and hashing, and which fits your Australian business.