Optimize scans
Optimize scans an existing dbt project for concrete, fixable issues and proposes targeted fixes - with cost and impact reporting so you can prioritize. Where Refactor reshapes structure, Optimize hunts for discrete improvements.
Runs, candidates, and batches
Runs
A scan run analyzes the repository and produces a set of candidates. You can create runs, list past runs, and drill into any run's results.
Candidates
A candidate is a single detected issue - for example an inefficient materialization, a repeated pattern that should be DRY'd up, or a missing test. For each candidate you can review the details and request a fix, which the agent generates.
Batches
Related fixes are grouped into batches. A batch has an impact report so you can see the combined effect - including estimated cost changes - before applying it.
What Optimize looks for
Typical categories include:
- Performance & materialization - models that would benefit from a different materialization or query rewrite.
- DRY - repeated logic that should be factored into shared models or macros.
- Testing - models missing tests or documentation.
Reviewing and applying
Optimize is review-first: nothing changes your repo until you accept a fix. You review candidates, generate fixes, group them into batches, check the impact, and apply - with changes landing as pull requests.
Optimize vs Refactor
| Optimize | Refactor | |
|---|---|---|
| Unit of work | Individual issue → fix | Structural task in a pipeline |
| Best for | Targeted cleanups, cost/perf wins | Reorganizing, renaming, re-layering, semantic layer |
| Output | Fix candidates grouped into batches | Task DAG with staged PRs |