Skip to main content
SQL โ€ข LESSON 178

Incremental Filter

How can we query only records updated after the highest timestamp in our target table?

Advancedโฑ 3 Minutesโญ 1910 XP
๐Ÿค” THE QUESTION

How can we query only records updated after the highest timestamp in our target table?

๐Ÿ’ก WHAT IS IT?

Using a subquery for MAX(updated_at) implements a dynamic high-watermark incremental ETL filter.

๐ŸŽฏ WHAT IS IT USED FOR?

High-watermark incremental loads, minimizing compute costs, continuous data warehouse synchronization.

๐Ÿ’ป EXAMPLE
SELECT *
FROM source_orders
WHERE updated_at > (
    SELECT MAX(updated_at)
    FROM target_orders
);

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for Incremental Filter.

  • โœ“ High-watermark incremental ETL
  • โœ“ MAX(updated_at) subquery
  • โœ“ Target synchronization
  • โœ“ Efficient pipeline extraction