<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>CDC on josiete.com</title><link>https://www.josiete.com/en/tags/cdc/</link><description>Recent content in CDC on josiete.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 07 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.josiete.com/en/tags/cdc/index.xml" rel="self" type="application/rss+xml"/><item><title>CDC: keep data in sync without copying everything again</title><link>https://www.josiete.com/en/posts/cdc-change-data-capture/</link><pubDate>Wed, 07 Oct 2026 00:00:00 +0000</pubDate><guid>https://www.josiete.com/en/posts/cdc-change-data-capture/</guid><description>&lt;p&gt;&lt;img src="https://www.josiete.com/images/cdc-change-data-capture.webp" alt="A transactional database sends small blocks of changes to an analytical system"&gt;&lt;/p&gt;&#10;&lt;p&gt;Imagine a shop with ten million orders in its database. The analytics team needs to query today&amp;rsquo;s sales, so it copies those orders into an analytical warehouse every night. If only ten thousand changed today, transferring all ten million again is slow and expensive. &lt;strong&gt;Change Data Capture (CDC)&lt;/strong&gt; identifies the changes so the pipeline can send only what is needed.&lt;/p&gt;&#10;&lt;p&gt;The idea is simple: after creating an initial copy, the pipeline observes which records are inserted, updated, or deleted at the source. Each change becomes an event that the destination can apply. This updates the affected part of the data without rebuilding the entire dataset on every run.&lt;/p&gt;&#10;&lt;h2 id="from-the-transactional-system-to-analytics"&gt;From the transactional system to analytics&lt;/h2&gt;&#10;&lt;p&gt;The shop uses an &lt;strong&gt;OLTP&lt;/strong&gt; database to record orders and payments. It is optimized for many short transactions: creating an order, changing its status, or cancelling a purchase. The business team uses an &lt;strong&gt;OLAP&lt;/strong&gt; system — a data warehouse, for example — to aggregate sales by day, product, and region. These are different workloads, and analytical queries should not compete with the shop&amp;rsquo;s operations.&lt;/p&gt;&#10;&lt;p&gt;Without CDC, a simple solution would periodically export the entire &lt;code&gt;orders&lt;/code&gt; table. With CDC, the flow changes:&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="https://www.josiete.com/images/cdc-flow-en.svg" alt="Diagram: an initial copy moves data from OLTP to OLAP; afterwards the transaction log feeds a CDC capture process that sends only inserts, updates, and deletes to the analytical system"&gt;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Initial copy:&lt;/strong&gt; existing orders are loaded into OLAP. This step is still needed when the destination starts empty.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Capture:&lt;/strong&gt; the CDC process reads committed changes from the database&amp;rsquo;s transaction log, when the engine and connector support it. PostgreSQL uses its WAL, for example, while MySQL uses its binlog.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Apply:&lt;/strong&gt; the pipeline transforms events and updates analytical tables. It must preserve the order key and handle deletions correctly.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Suppose the ten million orders have already been copied. Over the next hour, 8,000 are created, 1,500 are updated, and 500 are cancelled. The next step processes &lt;strong&gt;10,000 changes&lt;/strong&gt;, rather than another ten million rows. If order &lt;code&gt;P-42&lt;/code&gt; moves from “pending” to “paid,” the destination updates that order. If a record is deleted, it receives a deletion event instead of waiting to discover the missing row in a new full export.&lt;/p&gt;&#10;&lt;h2 id="what-are-the-benefits"&gt;What are the benefits?&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Less data transferred:&lt;/strong&gt; when only a small part of a table changes, there is no need to move the whole dataset on every cycle.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Less repeated work:&lt;/strong&gt; full reads at the source and reloads at the destination are reduced, although capture still uses resources.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Fresher data:&lt;/strong&gt; changes can flow continuously or in frequent batches, depending on the design and capacity of the systems. CDC does not guarantee zero latency.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Inserts, updates, and deletes are visible:&lt;/strong&gt; a cursor such as &lt;code&gt;updated_at&lt;/code&gt; usually finds new and modified rows, but needs another mechanism to detect physical deletes; the transaction log can include them.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;More possible destinations:&lt;/strong&gt; the same events can feed analytics, search, or caches, provided each consumer applies its own logic.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="what-needs-attention"&gt;What needs attention&lt;/h2&gt;&#10;&lt;p&gt;CDC is not a “set and forget” feature. The initial load and log reading must be coordinated so changes made during the copy are not lost. The process must also store its &lt;strong&gt;log position&lt;/strong&gt; to resume after an interruption, and the source must retain logs long enough for it to catch up.&lt;/p&gt;&#10;&lt;p&gt;At the destination, applying events by key should be &lt;strong&gt;idempotent&lt;/strong&gt;: retrying a delivery must not duplicate an order. Teams also need to monitor source-to-destination lag, schema changes, and the meaning of a deletion in analytical tables. If the saved log position is lost or the log expires before it is read, a new load or reconciliation may be necessary.&lt;/p&gt;&#10;&lt;h2 id="common-tools"&gt;Common tools&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://debezium.io/documentation/reference/stable/architecture.html"&gt;Debezium&lt;/a&gt; provides connectors that capture database changes and publish them as events. &lt;a href="https://docs.airbyte.com/platform/understanding-airbyte/cdc"&gt;Airbyte&lt;/a&gt; offers CDC synchronization in supported connectors to move data between a source and a destination. &lt;a href="https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Task.CDC.html"&gt;AWS Database Migration Service (DMS)&lt;/a&gt; can combine an initial load with ongoing replication, or capture only changes when the destination is already populated. Exact support and setup depend on the database and destination.&lt;/p&gt;&#10;&lt;p&gt;CDC does not remove the first copy or replace analytical data modeling. Its value lies in what happens afterwards: replacing millions of repeated row copies with a manageable stream of changes, so analytics can keep up with the business without starting over every time.&lt;/p&gt;&#10;</description></item></channel></rss>