Data platforms

Change data capture: turning your database into a reliable event stream

Most companies already have their most valuable event stream. It is sitting inside the database's transaction log. Change data capture lets you use it without rewriting every application.

ExplainerSumanta Mukhopadhyay7 min read5 sources
#data#platform#mongodb#fintech
EXPLAINER · DATA PLATFORMS19 Oct 2026 · 16:30 GST

When I re-architect a system around events, the first question is usually "do we have to change every service to publish events?". Often the answer is no. Every write already goes through the database, and the database already keeps an ordered log of every change. Change data capture reads that log and turns it into a stream.

Polling versus the log

The simple approach is polling: query for rows with a newer updated_at every few seconds. It misses deletes, adds load to the database, and struggles with ordering. Log-based CDC reads the database's own change log instead. Debezium's documentation describes it as capturing all data changes with very low delay, in the millisecond range for databases such as MySQL and PostgreSQL, without the CPU cost of frequent polling2.

SourceNative mechanismCommon tooling
PostgreSQLLogical decoding of the write-ahead log4Debezium connector
MongoDBChange streams over the oplog3Change streams directly, or Debezium
MySQL and othersBinary logDebezium connectors for Kafka Connect1

Where CDC earns its keep

  • Feeding analytics and search without nightly batch jobs: the warehouse, search index and vector index stay seconds behind the source.
  • Keeping RAG indexes fresh. When a document or record changes, the change event triggers re-embedding, so retrieval never serves stale content. This pairs naturally with hybrid search in MongoDB.
  • Strangling a monolith. New services subscribe to changes in the legacy database while it keeps running.
  • Audit and lineage, because every change becomes an immutable event with a position in the log.

Raw tables or deliberate events?

The fastest way to start is to stream tables as they are. The cost is coupling: every consumer now depends on your internal schema, and renaming a column becomes a breaking change across teams.

For events other teams depend on, I combine CDC with the transactional outbox pattern. The service writes a deliberate, versioned event into an outbox table in the same transaction as its business data, and CDC publishes the outbox5. You get the reliability of the log with a contract you control. I cover the pattern for payments and orders in idempotent payment and order pipelines.

Raw table streams for internal replication and analytics; outbox events for anything another team builds on. Mixing the two up is a common CDC design mistake.

Pitfalls to plan for

  1. Initial snapshots. Connectors usually begin by snapshotting current state before streaming changes. Debezium supports initial and incremental snapshots2; plan for the load and the time on large tables.
  2. Log retention. If a connector is down longer than the database keeps its log, you lose your place and need a new snapshot. Monitor connector lag, and size retention for your worst outage.
  3. Schema changes. Decide how consumers handle new and removed fields before the first migration, not during it.
  4. Sensitive data. Change events carry whatever the row carries. Filter columns and mask values at the connector, which Debezium supports2, rather than trusting every consumer.
  5. Duplicates. After restarts, events can be redelivered. Consumers must be idempotent.

A sensible first step

Pick one high-value flow, such as orders into the warehouse or documents into a search index. Stream it with CDC, measure end-to-end lag, and run it alongside the existing batch job until the numbers match. Then retire the batch job. It is the lowest-risk path from nightly ETL to real time, and it is a pattern I have used on high-volume systems.

How I can help

I design event-driven data platforms, from CDC and outbox patterns to streaming into warehouses, search and AI retrieval. As a fractional CTO I can own the migration plan. Or analyse your challenge and bring the result to a call.

References
  1. 1
  2. 2
  3. 3
    Change StreamsMongoDB documentation
  4. 4
    Logical DecodingPostgreSQL documentation
  5. 5
    Pattern: Transactional outboxmicroservices.io, Chris Richardson
FAQ

Common questions

What is change data capture?

CDC captures row-level inserts, updates and deletes from a database, usually by reading its transaction log, and publishes them as an ordered stream of events that other systems can consume.

Is log-based CDC better than polling?

Usually. Log-based CDC captures every change, including deletes, with low latency and without repeatedly querying the database. Debezium's documentation notes millisecond-range delays for databases such as MySQL and PostgreSQL.

Should I stream my tables directly or use an outbox?

Streaming raw tables is quick but couples consumers to your internal schema. For events other teams depend on, combine CDC with the transactional outbox pattern so you publish deliberate, versioned events.

Keep reading

Related

Open to advisory, fractional CTO & select builds

Let's talk about what you're building.

The fastest route is a free 30-minute call. Prefer to write? Send a message and I'll reply personally within two business days.

Start a conversation

How would you like to reach me?

Book a 30-min callFastest. Pick any open slot on my calendar.→ Write in GmailOpens a pre-filled draft in your browser.→ Use my email appOutlook, Apple Mail or your default client.→

I reply personally within two business days. US & UAE time zones.