Materializations (view, table, incremental, ephemeral)
Choose view, table, incremental, or ephemeral materializations for cost and freshness trade-offs.
In plain words
Scan cost, consumers, and update cadence. Next, live, rebuilt, merged, or inline. Finally, warehouse bytes, duration, freshness, and failure recovery.
Think of it like…
A view is a live recipe, a table is a plated batch, incremental is editing yesterday's batch with new orders, and ephemeral is an unpublished prep instruction copied into the final recipe.
Where you’ve seen it
{{ config(materialized='incremental', unique_key='event_id', incremental_strategy='merge') }} reads a lookback when is_incremental(), but a daily full table remains the fallback for ambiguous correction windows.
Words you’ll hear
- view/table
- A logical persisted query with little storage but recomputation on each access.
- incremental
- A physical full-rebuild relation suited to stable, repeatedly queried models when rebuild cost is acceptable.
- ephemeral
- A model that updates an existing target on non-full-refresh runs based on a merge/delete-insert/append strategy.
- Operational boundary
- A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access. Match materialization to freshness/query frequency and recovery: test incremental predicates on late keys, use tables for reused costly marts, views for light stable logic, and ephemeral only for small composable fragments.
Visual diagram
Theory & deep dive
view/table: the working mechanism
dbt view keeps source queries live, table rebuilds persisted results, incremental updates a target, and ephemeral inlines SQL as a CTE into downstream consumers.
Scan cost, consumers, and update cadence. Live, rebuilt, merged, or inline, then predicate, key, grants, and late behavior; this exposes the state governed by ephemeral.
{{ config(materialized='incremental', unique_key='event_id', incremental_strategy='merge') }} reads a lookback when is_incremental(), but a daily full table remains the fallback for ambiguous correction windows.
view keeps source queries live, table rebuilds persisted results, incremental updates a target, and ephemeral inlines SQL as a CTE into downstream consumersMaterializations: failure mode and production response
A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access.
Match materialization to freshness/query frequency and recovery: test incremental predicates on late keys, use tables for reused costly marts, views for light stable logic, and ephemeral only for small composable fragments. Track Incremental key as "unique target identity or deterministic range", and make View chain depth visible to the dataset owner.
How it works, step by step
Step 1 of 41. Profile node
Scan cost, consumers, and update cadence. dbt view keeps source queries live, table rebuilds persisted results, incremental updates a target, and ephemeral inlines SQL as a CTE into downstream consumers.
- Incremental key
- unique target identity or deterministic range
- incremental
- A physical full-rebuild relation suited to stable, repeatedly queried models when rebuild cost is acceptable.
When to use it & trade-offs
What it is
dbt view keeps source queries live, table rebuilds persisted results, incremental updates a target, and ephemeral inlines SQL as a CTE into downstream consumers. {{ config(materialized='incremental', unique_key='event_id', incremental_strategy='merge') }} reads a lookback when is_incremental(), but a daily full table remains the fallback for ambiguous correction windows.
Why it matters: A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access. Match materialization to freshness/query frequency and recovery: test incremental predicates on late keys, use tables for reused costly marts, views for light stable logic, and ephemeral only for small composable fragments.
When to reach for it
- Choose view, table, incremental, or ephemeral materializations for cost and freshness trade-offs.
- Choose view/table because it provides this capability: A logical persisted query with little storage but recomputation on each access.
- Keep evidence for Incremental key at "unique target identity or deterministic range" so the last production stage-Measure - warehouse bytes, duration, freshness, and failure recovery-remains testable.
When to avoid or be careful
- A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access.
- Do not conflate incremental with view/table. The second concept contributes different behavior: A physical full-rebuild relation suited to stable, repeatedly queried models when rebuild cost is acceptable.
- Release only after this guardrail is in place: Match materialization to freshness/query frequency and recovery: test incremental predicates on late keys, use tables for reused costly marts, views for light stable logic, and ephemeral only for small composable fragments.
view/table / incremental / ephemeral - roles, limits, and operating cost
Strengths: A logical persisted query with little storage but recomputation on each access. dbt view keeps source queries live, table rebuilds persisted results, incremental updates a target, and ephemeral inlines SQL as a CTE into downstream consumers.
Watch out: A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access.
Strengths: A physical full-rebuild relation suited to stable, repeatedly queried models when rebuild cost is acceptable. In this workflow it supports: Compile/test - predicate, key, grants, and late behavior.
Watch out: The operating cost is real: number of live compute layers per consumer query.
Strengths: A model that updates an existing target on non-full-refresh runs based on a merge/delete-insert/append strategy. Its output can be checked with Table rebuild.
Watch out: Operating guardrail: Match materialization to freshness/query frequency and recovery: test incremental predicates on late keys, use tables for reused costly marts, views for light stable logic, and ephemeral only for small composable fragments.
Interview signals & numbers to know
When this topic comes up
- “Where is the failure boundary for view/table, and how would Incremental key reveal it?”
- “Why is incremental distinct from this behavior: a model that updates an existing target on non-full-refresh runs based on a merge/delete-insert/append strategy?”
- Production clue: A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access.
- Design probe: Match materialization to freshness/query frequency and recovery: test incremental predicates on late keys, use tables for reused costly marts, views for light stable logic, and ephemeral only for small composable fragments.
Benchmarks & rules of thumb
- Incremental key
- unique target identity or deterministic range
- View chain depth
- number of live compute layers per consumer query
- Table rebuild
- bytes/cost per model versus incremental complexity
Common mistakes & follow-ups
Common interview mistakes
- A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access.
- Reporting success from a job exit code without checking Incremental key and View chain depth.
- Treating this example as complete without replay, rollback, or access boundaries:
{{ config(materialized='incremental', unique_key='event_id', incremental_strategy='merge') }}reads a lookback whenis_incremental(), but a daily fulltableremains the fallback for ambiguous correction windows.
Likely interviewer follow-ups
- How would you prove this contract instead of only checking that the command ran: A logical persisted query with little storage but recomputation on each access.
- What does the recovery plan do when this occurs? A view stacks expensive joins for every query, a full table ignores reuse economics, an incremental model can silently skip late rows, and an ephemeral node hides intermediates needed to debug or restrict access.
- When is view/table insufficient for View chain depth, and what does adding incremental cost in Incremental key?
view keeps source queries live, table rebuilds persisted results, incremental updates a target, and ephemeral inlines SQL as a CTE into downstream consumers. Then make the answer operational: Match materialization to freshness/query frequency and recovery: test incremental predicates on late keys, use tables for reused costly marts, views for light stable logic, and ephemeral only for small composable fragments.Knowledge check
Put it into practice
Practice related interview Q&A
Apply Materializations (view, table, incremental, ephemeral) with data engineer interview Q&A and hands-on practice.