Skip to content
BENIBIX Learn

Incremental Model (dbt)

Data⚙️ ProcessingData Transformation

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

An incremental model is a dbt model that adds only new or changed rows on each run. The first run builds the whole table. Later runs use the is_incremental() check to pick just the new rows and add them. This is much faster than rebuilding a big table every time. The --full-refresh flag rebuilds it from scratch.

Example code

sql
{{ config(materialized='incremental') }}

select * from {{ ref('events') }}
{% if is_incremental() %}
where event_time > (select max(event_time) from {{ this }})
{% endif %}
On later runs, only rows newer than the table's latest one are read.
The highlighted model is incremental. Each run adds only the rows that are new.

Common mistake

Forgetting late rows. A row that arrives late with an old time is skipped by the filter for good.

Key takeaways

  1. 1
    Build once. The first run makes the full table.
  2. 2
    Add the new. Later runs pick only new rows.
  3. 3
    Full refresh. Rebuild from scratch when logic changes.

Compare