⚙️Incremental Model (dbt)
Also known as dbt Incremental Model, Incremental Materialization
A dbt model that adds just the new rows on each run.
Think of it like
It is like a diary. Each day you add a page. You do not write the whole book again.
Example
An events table has 2 billion rows and gets 5 million a day. The incremental model adds the 5 million in minutes instead of rebuilding all of it.
Why it matters
Big tables would take hours and cost a lot to rebuild each night. Adding only new rows keeps runs short and cheap.
Definition
Example code
sql
{{ config(materialized='incremental') }}
select * from {{ ref('events') }}
{% if is_incremental() %}
where event_time > (select max(event_time) from {{ this }})
{% endif %}Common mistake
Key takeaways
- 1Build once. The first run makes the full table.
- 2Add the new. Later runs pick only new rows.
- 3Full refresh. Rebuild from scratch when logic changes.