Watermarking vs. Change Data Capture (CDC) in Data Engineering

Published 2026-10-18 in Data Engineering

Introduction

In modern data engineering, organizations continuously generate and update large amounts of data. Processing the entire dataset every time a pipeline runs is inefficient, time-consuming, and expensive.

To solve this problem, data engineers use incremental data processing , where only new or changed data is processed instead of reprocessing everything.

Two commonly used techniques are:

Watermarking — Tracks records using a timestamp or incremental ID.

Change Data Capture (CDC) — Tracks actual changes made to the source data, including inserts, updates, and deletes.

Although both approaches reduce unnecessary data processing, they work differently and are suitable for different requirements.

1. What Is Watermarking?

Watermarking is an incremental data processing technique that identifies records to process based on a previously saved timestamp or incremental ID.

Instead of reading the entire source table, the pipeline processes only the records that have a watermark value greater than the last successfully processed value.

How Watermarking Works

Consider a source database containing customer records.

ID Name updated_at

1001 Alice 2024-01-01

1002 Bob 2024-01-02

1003 Charlie 2024-01-03

1004 David 2024-01-04

Suppose the pipeline has already processed records up to ID 1000 .

The saved watermark is:

Last Watermark = 1000

During the next pipeline execution, the system retrieves records with IDs greater than 1000.

For example, if the new records range from 1001 to 1050, only those 50 records will be processed.

After successfully processing the records, the watermark is updated to 1050.

During the following execution, the pipeline starts looking for records with IDs greater than 1050.

SQL Example

SELECT *

FROM customers

WHERE id > 1000

ORDER BY id;

Watermarking can also use a timestamp column:

SELECT *

FROM customers

WHERE updated_at > '2024-01-03 00:00:00';

This approach is commonly used in scheduled ETL pipelines, Azure Data Factory, Databricks, and other data integration systems.

Advantages of Watermarking

Simple implementation: Easy to design, develop, and maintain.

Reduced processing: Only qualifying records are retrieved.

Lower costs: Avoids repeatedly reading the entire dataset.

Efficient batch processing: Suitable for daily, hourly, or scheduled incremental loads.

Minimal infrastructure: Generally does not require access to database transaction logs.

Limitations of Watermarking

Deleted records may be missed: If a record is physically deleted from the source, it may no longer appear in incremental queries.

Updates depend on the watermark column: An incremental ID alone does not detect updates to older records.

Timestamp reliability matters: If updated_at is not maintained correctly, changes may be missed.

Late-arriving data: Records with old timestamps can be skipped unless the pipeline uses an appropriate lookback strategy.

Important: Watermarking is most effective when the source system provides a reliable, consistently maintained timestamp or incremental column.

2. What Is Change Data Capture (CDC)?

Change Data Capture (CDC) is a technique used to identify and capture actual changes made to a source database, including INSERT, UPDATE, and DELETE operations.

Unlike watermarking, CDC focuses on what has changed in the source system rather than simply identifying records newer than a saved value.

CDC can capture changes using mechanisms such as database transaction logs, change tables, or database-specific change-tracking features.

How CDC Works

Suppose a customer database contains the following records:

ID Name

2001 Alice

2002 Bob

2003 Charlie

Now imagine these changes occur:

A new customer named David is inserted.

Bob's information is updated.

Charlie's record is deleted.

A CDC-enabled pipeline can capture these changes as separate events.

Operation ID Description

INSERT 2004 David added

UPDATE 2002 Bob's information changed

DELETE 2003 Charlie removed

The CDC process then delivers these events to the target system, where the appropriate changes can be applied.

This helps keep the target database synchronized with the source.

Example: CDC with Delta Lake

In a Delta Lake pipeline, captured CDC events can be applied using a MERGE operation.

For example:

MERGE INTO target_customers AS target

USING source_changes AS source

ON target.id = source.id

WHEN MATCHED

AND source.operation = 'DELETE'

THEN DELETE

WHEN MATCHED

AND source.operation = 'UPDATE'

THEN UPDATE SET

target.name = source.name

WHEN NOT MATCHED

AND source.operation = 'INSERT'

THEN INSERT (id, name)

VALUES (source.id, source.name);

This example assumes incoming CDC events have been prepared so that there is at most one applicable change per customer for the merge. Multiple events for the same record may require ordering and additional processing.

More Data Engineering articles · All collections · Practice challenges

Practise what you just read: data engineer interview questions · data engineering projects · Databricks certification practice exams.