PR review workflows for dbt changes - Time & Space Complexity
When reviewing dbt changes in a pull request, it's important to understand how the time to check and test these changes grows as the project size increases.
We want to know how the review process scales with more models and tests.
Analyze the time complexity of this simplified dbt PR review workflow snippet.
-- models/my_model.sql
select * from source_table
-- tests/my_model_test.sql
select count(*) from {{ ref('my_model') }} where id is null
-- dbt_project.yml
models:
my_project:
+materialized: table
-- PR review steps:
-- 1. Run dbt compile
-- 2. Run dbt test
-- 3. Review changed models and tests
This snippet shows a simple dbt model and test, with a typical PR review workflow running compile and test commands.
In the PR review workflow, the main repeated operations are:
- Primary operation: Running tests on each changed model.
- How many times: Once per changed model and its tests.
As the number of changed models increases, the time to run tests and review grows roughly in direct proportion.
| Number of Changed Models (n) | Approx. Review Time |
|---|---|
| 1 | Short (few minutes) |
| 10 | About 10 times longer |
| 100 | About 100 times longer |
Pattern observation: The review time grows linearly with the number of changed models and tests.
Time Complexity: O(n)
This means the review time increases directly with the number of changed dbt models and tests.
[X] Wrong: "Review time stays the same no matter how many models change."
[OK] Correct: Each changed model adds tests and code to check, so more changes mean more work and longer review time.
Understanding how review time grows helps you plan and communicate better in real projects, showing you grasp practical workflow scaling.
"What if we only ran tests on models that actually changed instead of all models? How would the time complexity change?"