All rules Rule BP009
note
hosted, paid — --remote

Column statistics disabled with SET STATISTICS 0

Note — this works and blocks nothing, but a performance regression is likely.

What it catches

SET STATISTICS 0 tells ANALYZE to collect nothing for the column. From then on the planner estimates every predicate on it with hard-coded defaults (selectivity 0.5 for equality, 1/3 for ranges) — row estimates go wrong by orders of magnitude, and with them join order, index choice, and memory sizing for every query that touches the column.

Fires on

ALTER TABLE orders ALTER COLUMN region SET STATISTICS 0;

Do this instead

Leave the target at -1 (the server default, currently 100 buckets) or raise it for skewed columns; if ANALYZE is too slow on a wide table, lower the target rather than zero it. Setting it back to -1 restores the default.

SET lock_timeout = '5s';
ALTER TABLE orders ALTER COLUMN region SET STATISTICS -1;
Catch this before it ships

This rule runs in the hosted service on Startup and above — add --remote with a team token, or use the GitHub Action: npx bolvrk check migration.sql