🚀

Change Data Capture (CDC)

Capturing changes efficiently from source systems.

Section 1 of 3: What is CDC?0%

What is CDC?

Study Material

Change Data Capture (CDC) is a technique for identifying and capturing changes made to data in a database, then delivering those changes in real-time or near-real-time to downstream systems.

Why CDC Matters:

Traditional approaches have significant drawbacks:

Polling/Querying (Traditional):

  • Query source every X minutes: WHERE updated_at > last_run
  • Misses deletes (no row to query!)
  • High load on source database
  • Not truly real-time
  • Requires updated_at column on every table

CDC (Modern):

  • Reads database transaction log
  • Captures ALL changes (insert, update, delete)
  • Minimal source impact
  • Near real-time (seconds)
  • Works without schema modifications

How CDC Works:

Databases maintain a transaction log (also called WAL, redo log, binlog) for recovery purposes. CDC tools read this log to capture changes.

Database Transaction Logs:

  • PostgreSQL: Write-Ahead Log (WAL)
  • MySQL: Binary Log (binlog)
  • SQL Server: Transaction Log
  • Oracle: Redo Log

CDC Capture Flow:

  1. 1Application writes to database
  2. 2Database records change in transaction log
  3. 3CDC tool reads transaction log
  4. 4CDC tool publishes change event
  5. 5Consumers process change event

Types of Changes Captured:

  • INSERT: New row added
  • UPDATE: Existing row modified (before + after values)
  • DELETE: Row removed

Popular CDC Tools:

ToolDatabasesOutput
DebeziumPostgreSQL, MySQL, MongoDB, OracleKafka
AWS DMSMost major databasesS3, Kinesis, RDS
Fivetran150+ connectorsCloud DWH
Airbyte300+ connectorsVarious destinations
Oracle GoldenGateOracle, othersVarious