Interview's MateData Engineer
Interview's Mate

Data Engineer

SQL · Spark · Lakehouse · Streaming

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Data Engineer topics
Lesson 104/ 160
06. Data Transformation (dbt) & Workflow Orchestration

Materializations (view, table, incremental, ephemeral)

Choose view, table, incremental, or ephemeral materializations for cost and freshness trade-offs.

Intermediateview/table · incremental · ephemeral3 quiz questions
Practice Generative AI Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

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

Loading interactive 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.

Materializations in one concrete design

{{ 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.

Key takeaway: dbt view keeps source queries live, table rebuilds persisted results, incremental updates a target, and ephemeral inlines SQL as a CTE into downstream consumers

Materializations: 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.

Key takeaway: 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.

How it works, step by step

Step 1 of 4
view/table

1. 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.

scan cost, consumers, and update cadence
Key numbers at this step
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

view/table
Best for: A logical persisted query with little storage but recomputation on each access.

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.

incremental
Best for: A physical full-rebuild relation suited to stable, repeatedly queried models when rebuild cost is acceptable.

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.

ephemeral
Best for: A model that updates an existing target on non-full-refresh runs based on a merge/delete-insert/append strategy.

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 when is_incremental(), but a daily full table remains 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?
Interview tip: Lead with the data path and failure boundary: dbt 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

Loading quiz

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.

Open Data Engineer Q&A →Machine Learning Q&A
Previous topic
dbt Project Structure (models, seeds, snapshots, macros, tests)
Next topic
Building Incremental Models (is_incremental(), Merge Strategies, Lookback Windows)