Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. Snapshots vs incremental models

dbt · Incremental Models & Performance

Snapshots vs incremental models

Harddbt-27
snapshotsscdincrementalhistory

Question

What is the difference between dbt snapshots and incremental models?

Solution

Both deal with change over time, but they solve different problems.

Incremental models

Build an up-to-date analytics table efficiently. The end state is usually "current grain" (one row per key, or append-only events), refreshed cheaply.

Snapshots

Capture how a source table changed historically (SCD Type 2 style). dbt records dbt_valid_from / dbt_valid_to (and hash) so you can query what a row looked like at a past time.

Incremental:  "efficiently maintain the latest fact/dim I need"
Snapshot:     "keep history of mutable source rows for as-of queries"

Snapshot sketch

{% snapshot customers_snapshot %}
{{ config(
    target_schema='snapshots',
    unique_key='customer_id',
    strategy='timestamp',
    updated_at='updated_at'
) }}
select * from {{ source('crm', 'customers') }}
{% endsnapshot %}

When to use which

  • Mutable source dimensions you must audit → snapshot
  • Large fact transforms you must refresh daily → incremental model
  • Sometimes: snapshot sources, then build incremental marts from snapshots

Interview tip: Do not call every incremental table a "snapshot." Snapshots are specifically dbt's SCD/history mechanism for source change tracking.

PreviousNext