db: raise env_builds.status statistics target - #3404
Conversation
PR SummaryLow Risk Overview Reviewed by Cursor Bugbot for commit 3e2e8f9. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
LGTM — straightforward, mechanical migration that mirrors the already-merged status_group statistics fix (20260725100500), applied to the env_builds.status column.
What was reviewed: the migration structure (NO TRANSACTION, bounded statement_timeout, ANALYZE, timeout restore, down path) is byte-for-byte consistent with the precedent migration; SET STATISTICS 2000 and the down path's -1 (revert to default) are correct Postgres semantics; no application code, queries, or schema shape changes are involved.
Extended reasoning...
Overview
Single new migration file that raises the statistics target on env_builds.status from default to 2000 and immediately re-analyzes the table. It is a direct copy of the pattern established in the already-merged 20260725100500_env_builds_status_group_statistics.sql migration, just applied to a different column (status instead of status_group). Up path: NO TRANSACTION, bump statement_timeout to 1h, ALTER COLUMN ... SET STATISTICS 2000, ANALYZE, restore statement_timeout to 3h (the migrator's baseline). Down path mirrors this, resetting statistics to -1 (Postgres default sentinel) and re-analyzing.
Security risks
None. This is operational DDL affecting query planner statistics only — no data exposure, no auth/permission changes, no new inputs or code paths.
Level of scrutiny
Low. This is infra/ops tooling for planner behavior, not production business logic, and follows a precedent already reviewed and merged for the sibling column. The only things worth checking — transaction handling for ANALYZE, timeout bounds, and reversibility of the down migration — all match the prior accepted pattern exactly.
Other factors
No CODEOWNER-sensitive paths, no schema shape change (statistics target changes don't require a table rewrite or lock beyond a brief catalog update), and the down migration is a clean, safe revert. Cursor's automated review also flagged it as low risk. Given the exact structural precedent, no human-blocking concerns exist.
Same treatment as env_builds.status_group (20260725100500): the column's rare values can drop out of the MCV list on an unlucky autoanalyze sample, leaving the planner to underestimate them by orders of magnitude on status-filtered queries. A larger per-column sample keeps every value visible across re-samples; the migration re-analyzes immediately.