Inferensys

Glossary

Change Data Capture (CDC)

A design pattern that identifies and captures row-level changes to a source database and streams them as events to downstream systems in real-time.
Engineer reviewing vector database search results on laptop, embeddings visualization on screen, home office coding session.
DATA INTEGRATION PATTERN

What is Change Data Capture (CDC)?

Change Data Capture is a design pattern that identifies and captures row-level changes to a source database and streams them as events to downstream systems in real-time.

Change Data Capture (CDC) is a software design pattern that identifies and tracks row-level modifications—INSERT, UPDATE, and DELETE operations—in a source database and immediately streams them as a real-time event log. Unlike traditional batch-based ETL processes that extract entire datasets on a schedule, CDC monitors the database's transaction log to capture only the deltas, providing a low-latency, non-intrusive mechanism for synchronizing heterogeneous systems.

This pattern is foundational for event-driven architectures, enabling reliable data replication, cache invalidation, and real-time analytics without impacting source database performance. Tools like Debezium and cloud services implement CDC by tailing the write-ahead log, transforming atomic commits into structured messages for platforms like Apache Kafka, thereby ensuring downstream consumers always operate on the most current state.

CORE MECHANISMS

Key Characteristics of CDC

Change Data Capture is not a single technique but a design pattern with distinct implementation approaches. Each method offers a different trade-off between latency, system load, and completeness.

02

Trigger-Based CDC

A database-level approach that uses native triggers to fire on data modification events. The trigger writes the change event to a separate shadow table.

  • Mechanism: AFTER INSERT/UPDATE/DELETE triggers execute custom logic to capture the change.
  • Drawback: Introduces performance overhead on the source transaction, as the trigger logic executes synchronously within the same database transaction.
  • Use Case: Suitable for legacy databases without transaction log access or when log-based tools are not supported.
03

Timestamp/Version-Based CDC

A polling method that relies on application-level columns to detect changes. The source table must have a LAST_UPDATED timestamp or a monotonically increasing version number.

  • Mechanism: A scheduled query selects rows where LAST_UPDATED > last_captured_time.
  • Critical Gap: Cannot natively detect hard deletes (DELETE removes the row and its timestamp entirely).
  • Latency: Higher than log-based methods due to the polling interval.
04

Change Data Capture vs. Change Tracking

A crucial distinction often conflated in system design. Change Tracking identifies which rows changed; Change Data Capture identifies what changed.

  • Change Tracking: A lightweight mechanism (e.g., SQL Server Change Tracking) that marks modified rows with a version number but does not capture the historical column values.
  • Change Data Capture: Captures the full delta—the actual column values before and after the modification.
  • Implication: For rebuilding state or auditing, CDC is required. For simple cache invalidation, change tracking may suffice.
05

Outbox Pattern vs. CDC

Two competing patterns for reliably publishing state changes from a transactional boundary. Understanding the trade-off is critical for microservice architectures.

  • Outbox Pattern: The application writes an event to an outbox table within the same database transaction as the business data. A separate process polls and publishes.
  • CDC: An external process reads the transaction log, decoupling the publication logic entirely from the application code.
  • Key Advantage of CDC: Zero application code changes and no risk of developers forgetting to write to the outbox table.
06

Schema Evolution in CDC Pipelines

A production-critical concern. When the source table schema changes (e.g., adding a column), the downstream consumers must not break.

  • Schema Registry Integration: Tools like Debezium serialize change events using Apache Avro and register the schema in a central registry.
  • Compatibility Modes: BACKWARD compatibility ensures new schema versions can be used to read old data; FORWARD ensures old consumers can read new data.
  • Breaking Change: Renaming a column without aliasing in the connector configuration will break the downstream stream processor.
CHANGE DATA CAPTURE

Frequently Asked Questions

Clear, technical answers to the most common questions about implementing and operating Change Data Capture in modern streaming architectures.

Change Data Capture (CDC) is a design pattern that identifies and captures row-level changes (INSERT, UPDATE, DELETE) to a source database and streams them as real-time events to downstream systems. It works by reading the database's transaction log—the immutable, sequential record of all committed changes—rather than querying the tables directly. This log-based approach is non-intrusive, imposes minimal overhead on the source database, and guarantees that changes are captured in the exact order they occurred. Tools like Debezium connect to the log (e.g., MySQL binlog, PostgreSQL WAL, or SQL Server transaction log), parse the entries, and emit structured events to a streaming platform like Apache Kafka. Each event contains the before-and-after state of the row, the operation type, and metadata like the transaction timestamp and log position, enabling consumers to reconstruct the full history of data mutations.

DATA SYNCHRONIZATION PATTERNS

CDC vs. Batch Processing vs. Dual Writes

A technical comparison of three architectural patterns for synchronizing data between operational databases and downstream systems in real-time streaming pipelines.

FeatureChange Data CaptureBatch ProcessingDual Writes

Data Freshness

< 1 sec

1-24 hours

< 1 sec

Source Load Impact

Low (log tailing)

High (full scans)

Medium (app writes)

Transactional Consistency

Schema Evolution Handling

Schema Registry required

Manual ETL updates

Application-level coupling

Failure Recovery

Offset-based replay

Full re-extraction

Manual reconciliation

Application Coupling

Decoupled

Decoupled

Tightly coupled

Operational Complexity

Medium

Low

High

Typical Latency Overhead

0.3%

0.5%

2-5%

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.