Data Engineering interview question · Most asked

What is change data capture (CDC), and why is log-based CDC preferred over polling?

Summary

CDC captures every insert, update and delete from a source database. Log-based CDC reads the database's replication log (PostgreSQL WAL via logical decoding, MySQL binlog) and emits changes in commit order, including deletes, with little load on the source. Polling queries see only current rows, miss deletes and intermediate updates, and repeatedly scan the primary.

Longer Answer

Tools such as Debezium or managed connectors take an initial snapshot, then stream change events (usually to a broker), tracking the log position to resume exactly. Consumers apply changes idempotently and in order per key. Risks: replication slots retaining WAL and filling the source disk if consumers stop, and schema changes flowing through the stream.

Key Points

  • Reads the database's own change log.
  • Captures deletes and every update.
  • Low source load, commit order.
  • Monitor slot lag and WAL retention.

Deep dive: ETL and Data Pipelines: Change Data Capture for Pipelines

Explanation

What interviewers look for

Delete handling, ordering, initial snapshot + log position, and the slot/WAL operational risk.

More most-asked Data Engineering questions

← All Data Engineering questions