6 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
This article explains how to use dbt's defer feature to improve CI/CD pipeline efficiency by only rebuilding modified models instead of the entire project. It covers the setup process, benefits, and potential pitfalls of implementing defer in dbt workflows.
If you do, here's more
Running dbt in production can be slow and costly, especially when every pull request triggers a full rebuild of your entire project. The dbt defer feature addresses this issue by allowing developers to reference tables and views from a previous dbt run using the --defer flag. This means only modified models are rebuilt, significantly cutting down on CI runtime and compute costs. The author shares that using dbt defer can reduce CI pipeline times by 60-80%. In a demo, a single mart modification dropped build time from 4 seconds to just 1 second.
Implementing dbt defer requires some setup. First, you need to generate and store the manifest from your production runs, making it accessible to your CI environment. The CI job must download this manifest, run dbt with the defer flag, and ensure that only modified models are selected for building. The article details specific state selection operators to optimize this process, with state:modified+ being the most useful for CI scenarios where downstream models also need testing.
The post includes a real-world example showing the impact of defer. When modifying one model, the total runtime without defer was nearly 4 seconds, while using defer cut it to just under a second. It outlines potential pitfalls, such as stale manifest files or schema mismatches, and offers solutions to avoid these issues. The author also highlights how defer can be beneficial not only in CI but also for local development, making it a versatile tool for dbt users.
Questions about this article
No questions yet.