MySQL CDC Patterns: Compare Binlog, Triggers and Polling

Compare MySQL CDC patterns for lakehouse ingestion: binlog, triggers and polling, with setup checks, recovery limits and a replay-safe design checklist.

MySQL CDC Patterns: Compare Binlog, Triggers and Polling

Binlog-based CDC is the default choice for streaming MySQL into a lakehouse: it captures inserts, updates and deletes from the binary log in commit order with low write-side overhead. Triggers and timestamp polling remain useful fallbacks when log access is unavailable. The pattern you pick decides your snapshot cost, delete fidelity and replay behaviour.

Image Source: unsplash

That sounds tidy, but the details decide whether your lakehouse tables stay correct. A connector that starts cleanly on day one can still drift six months later, when someone changes binlog_format, adds a table without a primary key, or replays a batch of events twice. The sections below separate what MySQL itself requires from what a particular connector such as Debezium requires, and they mark the dated configuration that older tutorials still recommend.

Key Takeaways

  • Row-based binary logging is the foundation. binlog_format defaults to ROW, and it was deprecated in MySQL 8.0.34, so new deployments should plan for row-only logging.

  • binlog_row_image=FULL is a connector requirement, not a MySQL CDC requirement. Debezium's MySQL connector documents it; other tools may accept MINIMAL.

  • Snapshots need a consistent read and a matching log position. START TRANSACTION WITH CONSISTENT SNAPSHOT under REPEATABLE READ fixes the read view, but only the connector's locking procedure ties that view to a binlog position cheaply.

  • Deletes need deliberate handling. Binlog CDC emits delete events and, by default, tombstones; polling cannot see a row that no longer exists.

  • Idempotency is your safety net. Merge on the primary key with a per-key monotonic source ordering field and a transaction-aware offset, then protect against deletes being replayed out of order.

  • Watch the pipeline. Alert on replication lag, binlog growth and schema-history errors before dashboards go stale. See the lakehouse architecture basics for where raw change tables land.

CDC Patterns Overview

CDC Patterns Overview

Image Source: unsplash

What Is CDC and What Does a Snapshot Add?

Change data capture watches a database's change stream and republishes each insert, update and delete as an ordered event. MySQL records those row changes in its binary log, which the MySQL 8.0 reference manual describes as the record of all changes to the data, used for replication and point-in-time recovery.

A change stream alone is not enough, though. It starts at some position, and everything before that position is missing. That gap is why every serious CDC pipeline pairs streaming with an initial snapshot: a consistent read of the current table contents at a known log position, after which the stream takes over. Snapshot first, stream second, and you have a complete picture. Skip the snapshot and your first dashboard will quietly under-count.

The snapshot also sets the tone for the rest of the pipeline, because it is where you feel table size, locking and I/O. That is the subject of the next section.

What Does MySQL Itself Require for CDC?

This is where a lot of teams burn a week. MySQL has a small set of hard requirements, and connectors add their own on top. Keep the two lists apart.

MySQL's own prerequisites are modest. Binary logging must be enabled for binlog-based capture (it is on by default in MySQL 8.0), the capture user needs REPLICATION SLAVE and REPLICATION CLIENT privileges, and a unique server-id is needed when the client attaches as a replica. Row-based formatting is what you want for change capture, and it is already the default.

Then there is the connector layer. Debezium's MySQL connector documentation requires binlog_format=ROW and binlog_row_image=FULL, supports MySQL 8.0 and later in current releases, and needs additional privileges — SELECT, RELOAD and SHOW DATABASES — so it can read schemas and take a consistent snapshot. GTIDs are optional for Debezium; it can track ordinary file-and-position offsets instead.

That distinction matters when you evaluate a different tool or a managed service. Copying Debezium's FULL setting into a tool that only needs changed columns costs binlog volume for no benefit. Copying only MySQL's requirements into Debezium leaves you with a connector that fails its startup checks.

Why Does CDC Matter for a Lakehouse?

A lakehouse gives you cheap storage and open table formats, so you can keep the raw change history next to the current state. CDC fills that history in near real time, which means reports, feature stores and downstream apps read from one governed copy instead of hammering the MySQL primary. You also stop writing bespoke nightly extract jobs for every table.

The bigger win is architectural. A unified lakehouse such as Singdata's single-engine platform lets the same engine handle the CDC merge and the analytical queries, so you are not exporting from one system to feed another.

How Do the Three CDC Patterns Compare?

Most MySQL-to-lakehouse pipelines come down to three capture mechanisms, and they fail in different ways. Read the table as a shortlist, not a verdict: a small internal tool with no log access is a legitimate home for polling, and a high-volume order table is a legitimate home for binlog capture.

Dimension

Binlog-based CDC

Trigger-based CDC

Query or polling CDC

Change source

Binary log written by the server at commit

AFTER INSERT / UPDATE / DELETE triggers writing to a shadow table

Periodic SELECT filtered by a watermark column such as updated_at

Capture latency

Variable: bounded by binlog read rate, network and sink commit; grows with backlog and sink pressure

Variable: bounded by how fast you drain the shadow table

Bounded by poll interval; worst case is one full interval plus query time

Delete visibility

Yes, explicit delete events

Yes, if the delete trigger writes a tombstone row

No; a deleted row simply disappears from the result set

Intermediate updates

All versions, in order

All versions, in order

Only the latest version at poll time; earlier versions are lost

Write-side overhead on MySQL

No extra statements in the application transaction, but binary logging costs I/O and disk, and sync_binlog adds a flush per commit

Extra work inside the same transaction as the application write, plus shadow-table contention

Extra read load at each poll; polling more frequently, or scanning without a usable index, increases source read load

Ordering guarantee

Commit order in the binlog stream; your sink must still preserve per-key order explicitly

Insert order in the shadow table, which you must sequence yourself

No ordering guarantee between two polled rows

Schema coupling

Loose; capture continues through most DDL when the connector parses it

Tight; every trigger references column names and breaks on rename or drop

Depends on the watermark column surviving DDL

Typical blocker

No log access on the managed instance, or insufficient privileges

DBA policy forbids triggers on application tables

Hard deletes, or a table with no reliable watermark column

Good fit for

Primary source of truth for lakehouse ingestion

Audit side-channels, or MySQL variants where you control every write path

Small reference and dimension tables, one-off backfills

Why Do Binlog Patterns Win on Delete Fidelity?

Because the binary log records deletes as data, not as absence. A row-level delete event carries the before-image of the row, so the consumer knows exactly which key to remove or mark. That is the property polling can never reproduce: a query cannot return a row that is gone.

There is a second, subtler advantage. The binlog is written by the server whether or not anyone reads it, so a binlog consumer adds no extra statements inside your application's transaction. That is not the same as zero source overhead — binary logging still costs write I/O and disk, and sync_binlog=1 flushes on every commit. Trigger-based capture, by contrast, puts real extra work inside the application's own transaction, and we will come back to that cost.

If you are still tuning the read path on the MySQL side, the MySQL analytics performance guide covers query-level fixes that sit alongside a CDC pipeline.

What Is Binlog-Based CDC?

Binlog-based CDC reads the binary log through the replication protocol and turns row events into change records. Conceptually it is the same connection a replica uses: the client asks the server for events from a position, and the server streams them.

The practical requirements are narrow. The capture user needs REPLICATION SLAVE and REPLICATION CLIENT; log_bin must be ON; and the log must still contain the position the consumer needs. That last point is the most common outage cause — binary log retention expires faster than a paused consumer expects, and recovery means a re-snapshot.

SHOW VARIABLES WHERE Variable_name IN ('log_bin','binlog_format','binlog_row_image','server_id');
  SHOW BINARY LOGS;
  

What Makes Trigger-Based Capture Expensive?

Every trigger fires inside the transaction that performed the change, and that changes the cost model. The application's write now includes an extra insert into the shadow table, which means more undo logging, more redo, and more contention on a table that is likely hot.

There is also an operational tail. Triggers are invisible to most application developers, so a column rename in an ORM migration can silently break capture until someone notices the gap. And because trigger bodies are stored objects, you now version them alongside schema changes.

Trigger capture can still earn its place. If your managed MySQL forbids replication users but allows DDL, triggers are a workable, if slower, fallback. Just budget for the overhead honestly rather than assuming it is free.

What Are the Limits of Polling Watermarks?

Timestamp polling looks simple: select rows where updated_at > last_seen, push them downstream, advance the watermark. Three problems hide in that sentence.

The first is granularity. If updated_at has second or millisecond resolution and two rows land in the same tick, a naive > comparison can skip one of them. Use > with a half-open window plus a dedup step, or page by (updated_at, id).

The second is clock and isolation. The watermark comes from the database server, but the row you read may have been committed after the last poll and before the current one — fine if you dedupe by key, wrong if you assume append-only.

The third, and the one no amount of engineering fixes, is deletes. There is no row left to select. A polling pipeline either ignores deletes and drifts, or you add soft-delete columns and accept that your application schema is now shaped by your pipeline.

What Are the Hard Parts in Practice?

Three issues account for most production incidents: snapshot consistency, deletes, and replay. The first two are about capture fidelity; the third is about everything downstream of the sink.

Ordering is the thread that ties them together. Row events arrive in commit order, but your sink may write them out of order if you parallelise by key. Two updates to the same row must land in the same partition or be merged in event order, otherwise the older value can overwrite the newer one. Concurrent transactions on the same row are the classic failure case, and they are invisible until a dashboard shows a value that was never true.

How Should the Snapshot Be Taken?

A snapshot must be consistent, which in InnoDB means one read view for the whole table. Under REPEATABLE READ, the default isolation level, START TRANSACTION WITH CONSISTENT SNAPSHOT establishes that read view at transaction start rather than at the first SELECT. The MySQL transaction documentation notes the clause does not change the isolation level, and only gives you a fixed snapshot when the level is REPEATABLE READ.

The older approach — FLUSH TABLES WITH READ LOCK — still appears in tutorials. It takes a global read lock and blocks writes across the whole server while you hold it. That is a very different trade: no MVCC, but a write outage for the duration of the lock. Use it only when the dump has to include non-transactional tables.

A consistent transaction on its own does not solve the boundary problem, either. It tells you which rows you saw, not which binlog position you must resume from, and nothing stops a commit from landing between your first SELECT and the moment you read a position. If you build this by hand, you have to sequence the two yourself: take the lock, start the consistent transaction, read the position, then read the tables, and only then release the lock. That is exactly what Debezium's MySQL connector does — it holds a global read lock (or table-level locks on managed instances that forbid global ones) while it starts a REPEATABLE READ transaction and records the binlog file and position, releases the lock, then scans tables and tags every snapshot row with that position. Its connector documentation lays out that ordering step by step.

The practical lesson: let the connector own this step. Re-implementing it with a hand-rolled START TRANSACTION WITH CONSISTENT SNAPSHOT plus a separate position read is where silent duplicates and missing rows come from.

Debezium defaults to snapshot.mode=initial, which snapshots schema and data on first start and then streams from the recorded position. Choose no_data when you only want schema, or schema_only when an earlier load already populated the data.

How Are Deletes Captured?

In binlog CDC, a delete arrives as a row event with op: "d", a before-image of the row and a null after-image. The message key is the row's key, so a merge on that key removes the record from your lakehouse table.

Debezium adds a second record by default: a tombstone with the same key and a null value, controlled by tombstones.on.delete. Tombstones exist for Kafka log compaction, which cannot delete an older record until it sees a null value for that key. Your consumer must handle both, so filter nulls explicitly instead of letting them crash a deserializer.

Trigger-based capture can record deletes if you add a delete trigger that writes the old key and a deleted flag. Polling cannot: the row is gone before the next SELECT.

How Do You Make Replay Safe?

Replays happen for ordinary reasons — a bad deploy, a schema history error, a consumer bug. The pipeline must survive re-reading the same events, which takes four separate mechanisms, not one.

First, merge instead of append. Write change events into a staging or bronze table, then apply a MERGE or UPSERT keyed on the primary key so the latest event wins.

Second, carry a per-key monotonic ordering field. Binlog file-plus-position is not a simple sortable number once files rotate, and a GTID is an identity for a transaction, not a general comparator you can sort on: two GTIDs from different source UUIDs have no shared numeric order, every row event in one transaction shares the same GTID, and parallel apply means the order you see them in is not guaranteed to be the commit order. What you need instead is a source-derived sequence that increases for every change to a given key — for example a connector-assigned offset or row-event sequence combined with a snapshot epoch, compared with > so a stale duplicate is a no-op.

Third, make offsets transaction-aware. Advance the stored position only when the whole transaction has been applied downstream. A half-applied transaction followed by a restart, with a position already moved forward, is how rows go missing without any error.

Fourth, protect deletes. A delete event that is replayed after a newer update to the same key would resurrect a row that should be gone. Keep the delete as a tombstone in the sink, apply it only when its ordering field is at least as new as the stored record, and keep enough delete state to cover your replay and out-of-order window. The lakehouse compaction and streaming latency guide covers the storage side of the same problem.

What Happens When the Schema Changes?

DDL is where CDC pipelines break in interesting ways. MySQL writes DDL into the binary log alongside row events, and Debezium parses each statement to update its in-memory model of the table. It persists those statements with their positions in an internal database schema history topic, which is how a restarting connector knows which schema applied at the position it resumes from.

That internal topic is connector state. Renaming the topic prefix, wiping it, or pointing a connector at a different one strands it: the connector cannot rebuild the schema, and it stops with a schema history error rather than guessing. Keep it versioned and backed up like any other stateful store.

Some specific DDL behaviour is worth memorising. Adding a nullable column is cheap — the connector picks it up and older rows carry nulls until they change. A column rename depends on the connector knowing the new name; if you also depend on downstream consumers, expect to restart or have them tolerate the shift. Changing a primary key is the worst case, because past delete events no longer line up with the new key and old rows keep the old identity.

Test DDL in a staging replica with the same connector version before running it in production. A ten-minute dry run beats a two-day backfill.

How Do You Configure and Verify MySQL Correctly?

The settings below are a starting point, not a universal answer. Every value depends on your MySQL version, your connector and your retention policy, so treat this as a template to adapt.

Example configuration — validate in your target environment. These snippets are untested against your topology and are not a substitute for testing in a staging replica.

Version-Labelled Configuration Template

The block below reflects MySQL 8.0.x server variables. Note that expire_logs_days is deprecated and superseded by binlog_expire_logs_seconds; many older tutorials still show the former.

# my.cnf — MySQL 8.0.x, row-based CDC source
  [mysqld]
  server_id                     = 223344     # dynamic in MySQL 8.0, but set it at startup anyway
  # log_bin = ON by default in MySQL 8.0; set an explicit prefix if you need one
  log_bin                       = mysql-bin
  binlog_format                 = ROW          # dynamic; deprecated in 8.0.34, avoid MIXED in new designs
  binlog_row_image              = FULL         # required by Debezium, not by MySQL CDC in general
  binlog_expire_logs_seconds    = 604800       # 7 days; replaces expire_logs_days
  binlog_cache_size             = 1M           # per-session buffer for row events
  sync_binlog                   = 1            # flush to disk per commit; durability vs. write rate
  # gtid_mode                   = ON           # optional for Debezium; required for GTID-based failover
  # enforce_gtid_consistency    = ON           # must precede gtid_mode=ON
  

Which of these you can change at runtime is a common trap, and plenty of guides get it backwards. On MySQL 8.0.x, log_bin is startup-only — it reports whether binary logging is enabled, and you enable it with --log-bin (or the option file) at startup, never with SET GLOBAL. server_id is the opposite: it is a dynamic global variable, so SET GLOBAL server_id = <value> works. The value only takes effect for replication after a restart or FLUSH-style reinitialisation, though, so treat it as a startup concern in practice.

-- Dynamic on MySQL 8.0.x:
  SET GLOBAL server_id = 223344;
  SET GLOBAL binlog_format = 'ROW';
  SET GLOBAL binlog_row_image = 'FULL';
  SET GLOBAL binlog_expire_logs_seconds = 604800;
  -- NOT dynamic: log_bin must be set at startup (--log-bin in my.cnf) and a restart is needed.
  -- To keep a dynamic change across restarts, persist it:
  SET PERSIST binlog_expire_logs_seconds = 604800;
  

For the connector user, the privilege set depends on the tool. Debezium's documented minimum is:

CREATE USER 'cdc'@'%' IDENTIFIED BY 'CHANGE_ME';
  GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'cdc'@'%';
  

Verification Commands and Expected Observations

Run these on the source and check the results against what you configured. The expected observations below follow directly from the settings above; they are not measured benchmark results.

Step 1 — Confirm the logging variables are what you think.

SHOW VARIABLES WHERE Variable_name IN
    ('log_bin','binlog_format','binlog_row_image','binlog_expire_logs_seconds','server_id','gtid_mode');
  

Expect log_bin = ON, binlog_format = ROW, binlog_row_image = FULL, binlog_expire_logs_seconds = 604800, server_id = 223344, and gtid_mode = OFF unless you enabled GTIDs. If binlog_format reads MIXED or STATEMENT, something in another option file is overriding your setting.

Step 2 — Confirm logs are actually being written, and read the active file and position.

SHOW BINARY LOGS;
  SHOW BINARY LOG STATUS;   -- older/alternative spelling: SHOW MASTER STATUS;
  

Expect at least one file listed with a plausible size, and SHOW BINARY LOG STATUS to name the active file plus a position — call both out for later steps. What this pair does not tell you is retention time. SHOW BINARY LOGS lists file names and byte sizes; that is not a clock. To reason about headroom, compare the oldest file's timestamp (SHOW BINARY LOGS doesn't include it, so check the file's modification time on disk if you have access) against binlog_expire_logs_seconds, and remember that purge is time-based and not aware of your consumer: MySQL can delete a file your connector still needs. An empty list means binary logging is off. If the newest file is older than the expiration window you configured, automatic purge is probably disabled (binlog_expire_logs_auto_purge=OFF).

Step 3 — Inspect a row event without a connector.

CREATE DATABASE IF NOT EXISTS cdc_check;
  CREATE TABLE cdc_check.t (id INT PRIMARY KEY, v VARCHAR(32), updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
  INSERT INTO cdc_check.t VALUES (1,'a',NOW());
  UPDATE cdc_check.t SET v='b' WHERE id=1;
  DELETE FROM cdc_check.t WHERE id=1;
  

Then read from the file and position you recorded in Step 2. Substitute your own values — the file name and path depend on log_bin_basename, and the start position must be at least 4, because positions 0–3 sit in the file header and --start-position=0 is rejected:

# Replace <active-file> and <position-from-SHOW-BINARY-LOG-STATUS> with your observed values.
  mysqlbinlog --base64-output=DECODE-ROWS -vv --start-position=<position> <path-to-active-file>
  

What you should see, provided the three statements sit in that file after your start position (a rotation in between puts them in the next file) and the account can read the log: an INSERT with all three columns populated, an UPDATE showing v moving from a to b, and a DELETE whose before-image still contains the row values. Full column values in the update are the practical sign that binlog_row_image=FULL is active. Piping through tail -60 proves nothing by itself — the events may be earlier in the file, or a rotation may have moved them, so read the output rather than assuming a fixed window.

Step 4 — Confirm the capture user can read the log and schemas.

SHOW GRANTS FOR 'cdc'@'%';
  

Expect REPLICATION SLAVE and REPLICATION CLIENT in the output, along with SELECT, RELOAD and SHOW DATABASES if you are running Debezium. Missing REPLICATION SLAVE is the single most common startup failure.

Drop the scratch schema when you are done: DROP DATABASE cdc_check;

Numbered Setup Steps

  1. Enable row-based binary logging on the source and confirm it with the SHOW VARIABLES check above.

  2. Create a dedicated capture user with only the connector's documented privileges.

  3. Let the connector take the snapshot with its documented locking procedure, which fixes a consistent read view and records the binlog file and position (or GTID set) at the same moment.

  4. Stream row events from the recorded position into a staging table, keyed by primary key.

  5. Merge the staging table into your lakehouse table with an UPSERT, resolving ties by a per-key monotonic source ordering field and advancing offsets only after the whole transaction is applied.

  6. Schedule compaction so the merge does not leave a swamp of small files.

  7. Alert on replication lag, binlog retention headroom, and schema history errors.

Which Practices Actually Hold Up?

A few habits separate pipelines that survive a year from ones that get rebuilt.

Why Is Primary-Key Discipline Non-Negotiable?

Row-based replication identifies rows by key. A table without a primary key makes deletes and updates ambiguous: the connector cannot reliably match a before-image to a downstream row, and some tools refuse to capture such tables at all.

The MySQL server has a guard for this. sql_require_primary_key causes CREATE TABLE and ALTER TABLE to fail when a table would have no explicit primary key. Enabling it on your source is a cheap way to stop new keyless tables from appearing, though it will also fail any migration tool that creates them temporarily. If you cannot enforce it, at least alert on keyless tables in the schema the connector is tracking.

How Do You Keep Write Overhead Predictable?

Binlog capture writes log records the server already produces for replication, generated by the server rather than by your session — so it adds no extra statement to your application's transaction, but it is still not free on the source. Trigger capture does the opposite: it adds a statement to the application's own transaction. Keep the two costs separate when you capacity-plan, and don't repeat the myth that a binlog consumer costs the source nothing.

For the binlog side, the levers are binlog_cache_size (a per-session buffer; large transactions spill to a temporary file rather than growing it), sync_binlog (set to 1 for durability at the cost of a flush per commit), and retention. Short retention saves disk but shortens your tolerance for consumer downtime. Nothing here is free; pick which resource you are willing to spend.

On the sink side, watch for small-file accumulation from frequent merges, and compaction that has fallen behind the write rate. Backpressure during checkpoints and table compaction are the two usual bottlenecks, and both are visible in metrics before they show up as stale dashboards.

What Should You Monitor and Alert On?

Track three signals as a minimum. Replication lag tells you whether the sink is keeping up. Binlog retention headroom tells you how much downtime you can absorb before a re-snapshot is forced. Schema history health tells you whether the next DDL will stop the connector.

The MySQL-side commands are narrower than they look. SHOW REPLICA STATUS (the modern spelling of SHOW SLAVE STATUS) describes the replication channels configured on that server — its own receiver and applier threads. An external binlog client like Debezium does not register a channel, so SHOW REPLICA STATUS tells you nothing about its health; you may spot its connection in SHOW PROCESSLIST, but that is presence, not progress. SHOW BINARY LOGS lists file names and sizes, which is not the same as retention time: check the oldest file's age against binlog_expire_logs_seconds rather than inferring headroom from the byte count.

Latency has the same trap. The byte distance between a connector's position and the source's current position is a backlog figure, not a time. Event sizes vary, traffic is bursty, and a quiet hour can move few bytes while a busy minute moves a lot — so two pipelines with identical byte gaps can be minutes or hours apart. Measure time lag from source commit timestamps carried in your change events (or your connector's own metrics), and keep file and position only for tracking where to resume.

Set alerts on the connector's own lag and offset metrics, plus the age of your oldest binlog file. A process that answers a ping while its events are hours old still looks healthy.

How Do You Secure the Pipeline?

Security work here is mostly about narrowing privileges and protecting the log stream, which contains raw row data.

The capture user should have only the privileges its tool documents — no SUPER, no ALL. If you connect over a network, require TLS. Binary logs can be encrypted at rest with binlog_encryption, which matters when the log lives on shared storage. Restrict REPLICATION SLAVE to the connector's account so application users cannot drain the log.

Finally, decide how long raw change data may live in the lakehouse. Personal data that lands in a bronze table inherits your retention obligations, and cascading a delete through CDC history is a pipeline problem, not a policy that enforces itself. See the Singdata lakehouse security walkthrough for how access controls map onto lakehouse datasets.

FAQ

Sources checked on 2026-11-28 against the MySQL 8.0 reference manual and the Debezium stable MySQL connector documentation. Verify against the exact versions you run.

Do I Need to Enable binlog_format=ROW on MySQL 8.0?

Effectively no — it is already the default, and ROW is what change capture needs. But don't assume: confirm the runtime value, because an option file can override the default. Also plan for binlog_format being deprecated since MySQL 8.0.34, which signals that row-only logging is the direction the server is heading.

Is binlog_row_image=FULL Required for MySQL CDC?

Only for connectors that say so. Debezium's MySQL connector requires binlog_row_image=FULL; MySQL itself accepts MINIMAL and NOBLOB. FULL costs more log volume but gives every event a complete before–after image, which makes downstream merging and debugging simpler. Check your tool's documentation before copying the setting.

Can Trigger-Based CDC Replace Binlog Capture?

It can capture deletes and updates, but it pays for that inside your application's transaction. Each write also writes to the shadow table, adding contention and undo/redo work, and every trigger must be maintained through schema changes. Use triggers when log access is genuinely unavailable, and budget for the overhead.

Why Do My Polling Jobs Miss Deleted Rows?

Because a deleted row cannot be selected. Polling only sees rows that exist at query time, so hard deletes are invisible and intermediate updates between polls are lost. Binlog capture avoids this by recording deletes as events with a before-image, which the sink can apply as a delete by key.

What Happens if I Replay a Batch of CDC Events?

It depends entirely on your sink, and there is no blanket "safe". A keyed upsert with a per-key monotonic ordering field and transaction-aware offsets makes a duplicate event a no-op. Adding a GTID to that comparison gains you transaction identity, not ordering — GTIDs from different sources have no shared numeric order and rows inside one transaction share the same GTID. A replay also re-sends deletes, and the damage runs in both directions: an old update replayed after a newer delete can resurrect a key that should be gone, while an old tombstone replayed after a newer update can delete a row that was legitimately updated. Compare source ordering before applying either operation. Append-only sinks and keyless merges are where replays turn into duplicates or wrong values.

See Also


Primary sources checked 2026-11-28: the MySQL 8.0 binary logging options reference, the InnoDB isolation level documentation, and the Debezium MySQL connector reference. Version numbers and defaults change between releases; confirm against the manual for your MySQL and connector versions.

Related Articles