advanced 2 min answer

A transformation project has grown to hundreds of models with a build taking hours. What structural problems produce that, and what fixes them?

dbt-labsdagincrementalmodularitylineage
Show the full answer Hide the answer

The structural problems

  • Full recomputation of models whose inputs barely changed. Most models can be incremental — processing only new or changed rows — and full refresh is the default because incremental is harder to get right.
  • A dependency graph that is deeper than it needs to be, where each layer adds a small transformation and the build must traverse all of them serially.
  • Models nobody consumes. A meaningful proportion of scheduled analytical work produces artefacts nothing reads, and they are cheaper to find than to make faster.
  • Fan-out from a single upstream model that is expensive, recomputed once per downstream consumer rather than materialised once.
  • Wide models selecting every column, propagating unnecessary data through the graph.

What fixes them

  • Incremental materialisation for the large models, with a defined strategy for late-arriving and updated records — the part that makes incremental hard and that is frequently handled by hoping.
  • Prune the graph. Identify models with no downstream consumers over a period and remove them, which requires usage telemetry on the outputs.
  • Materialise the shared expensive intermediates rather than recomputing per consumer.
  • Parallelise on the graph's actual structure, since a wide graph parallelises well and a deep one does not — which argues for flattening where the intermediate layers add nothing.
  • Tests on the models that matter, since a build that runs a thousand assertions on unimportant tables is spending its time on the wrong thing.

The organisational cause underneath

Models are added continuously and removed never. Each addition is individually justified, nobody owns the graph as a whole, and the aggregate cost is nobody's decision — the same structural failure as feature-flag accumulation and unused index accumulation.

The fix is ownership of the graph plus periodic pruning, with usage telemetry making the pruning decision evidence-based rather than a negotiation.

The measurement that directs the effort

Cost and duration per model, plus consumers per model. The expensive models with no consumers are the first deletions; the expensive models with many consumers are the first materialisations. Both are visible in a day and neither is usually measured.