In this lesson, you will learn how to build sustainable data pipelines by processing only the specific slices of data that have changed since your last update.
As your analytical models grow from megabytes to terabytes, performing a "full load"—reprocessing your entire history every time you add a new row—becomes unsustainable. It wastes compute resources, increases latency, and risks system timeouts. Instead, we use incremental data loading to target only the "delta," or the new/modified data, keeping your performance stable as your dataset expands.
The Strategy: High-Water Marks
The most effective way to implement this is by using a "High-Water Mark." This is a tracking mechanism (usually a timestamp or an auto-incrementing ID) that records the last point of successful ingestion.
Imagine you have a Sales fact table. Instead of scanning every transaction ever recorded, your ETL workflow executes a logic similar to this:
-- Fetch only the records that occurred after our last successful run
SELECT *
FROM source_sales_system
WHERE updated_at > (SELECT last_load_timestamp FROM metadata_table);
Designing the Workflow
When you integrate this into your modeling layer, consider these two pillars:
- Change Tracking: Your source system must be able to identify what changed. If your source doesn't have an
updated_atcolumn, you may need to implement a Change Data Capture (CDC) process to log insertions and updates. - Idempotency: Because failures can happen, your loading workflow must be idempotent. If a process crashes halfway through, running it again should not result in duplicate records. Use your
DateorTransaction_IDkeys toMERGEorUPSERTnew data into your existing fact tables, effectively overwriting existing records if a primary key match is found.
By filtering for the delta, you ensure that your query execution time remains relatively constant, regardless of whether your total dataset contains 1,000 or 1,000,000,000 rows. This keeps your dashboard performance snappy and your infrastructure costs predictable.
Key Takeaway: By using High-Water Marks to process only the delta, you decouple your processing time from your total data volume, ensuring your analytics remain performant as your business scales.