Data and analytics

5 min read

Change Data Capture: How to Move Database Changes Without Making Applications Write Twice

When an application must save an order and also send it to analytics, search, or another system, dual writes look tempting. CDC takes a different path: commit the database change first, then capture what already happened.

One business operation often matters to many systems. An order is stored in the primary database, but its changes may also be needed by analytics, search, CRM, fraud detection, or a data platform.

The obvious approach is to make application code save the database record and then write the same information somewhere else. That creates a dual-write problem: the database may succeed while the second action fails, or the reverse.

What problem are we solving?

As integrations multiply, core business logic starts carrying responsibility for distributing data to unrelated systems.

Change Data Capture reads the database change log or another durable source of transactional changes and turns those changes into a stream.

The application does its primary job: commit the business state correctly. CDC notices the insert or update and publishes it for downstream consumers.

What the business gets

The main benefit is that new data consumers can be added with less change to critical transactional code.

That lowers integration cost. A new analytics initiative or channel does not need to modify checkout logic merely to obtain a copy of order data.

CDC also reduces the dual-write risk where the business operation succeeds but an external system never learns about it because of a temporary failure.

For the company, operational data becomes cheaper to reuse. The trade-off is delay: a secondary system will usually learn about the change slightly later than the primary database.

What the team gets

The team gets a common technical way to propagate data changes instead of building a different custom integration inside every service.

Streams can be replayed, new projections can be built, and consumers can evolve independently.

The downside is that database schema becomes more visible as an integration contract. A careless table change can unexpectedly break downstream consumers.

What the customer gets

Customers do not usually know CDC exists. They notice the consequences: search sees new data more reliably, analytics states update more consistently, and different product surfaces are less likely to drift because a second write was lost.

There can still be a short lag. An order may exist immediately while search or reporting sees it a few seconds later.

What we pay for it

The platform needs change-log readers, offset tracking, lag monitoring, and duplicate handling.

Consumers must tolerate replays, schema evolution, and the fact that raw database changes are not always a clean business contract.

If CDC is used as a universal replacement for well-designed domain events, internal storage details can spread throughout the organization.

When CDC is not needed

If data volume is small, there is one consumer, and the integration is simple, a normal API or explicit domain event may be clearer.

CDC is most useful when changes are frequent, consumers are numerous, or application-level dual writes are hard to make reliable.

Questions to ask before the decision

In the end

Change Data Capture is useful when data must leave the primary database reliably without turning the business transaction into a dispatcher for every external system.

For the business, it is a way to connect new use cases to existing data more cheaply while accepting asynchronous delivery and stronger schema governance.