Execution health · rule run-slow-test
dbt tests slower than the model they test
A Metacenta review checks this under the rule A test costs less than the asset it guards. Everything below applies whether or not you ever commission one.
What this rule checks
From the timings in your last run, this rule flags each test that took at least one second and longer than building the model it tests.
Why it matters
Checking the model costs more than producing it. Under time pressure this is the assertion that gets cut, and the usual fix is deleting the test rather than fixing it.
How to fix it
Cheapen the tests that cost more than the models they check. Narrow the test with a where: config that limits it to the rows that matter, such as recent partitions. Or record why the cost is accepted, so the next person does not simply drop it.
Before:
- name: event_id
data_tests:
- unique
After:
- name: event_id
data_tests:
- unique:
config:
where: "event_date >= current_date - 3"
When it is fine to leave
A test over a cheap view can legitimately cost more than building it, because the view does no work at build time. A critical test on a key table may also be worth its cost; write down that it is.
What we need to check it
run_results.json with timings for both the test and its model. One run is one sample, so we report this at medium confidence.