VACUUM FULL / CLUSTER / REINDEX rewriting under full lock
Critical — this fails outright or takes production down.
What it catches
VACUUM FULL and CLUSTER rewrite the entire table under ACCESS EXCLUSIVE; plain REINDEX locks writes on the table while rebuilding. All three look like harmless maintenance and take the table down for the duration. Plain VACUUM (without FULL) needs no such lock, and REINDEX CONCURRENTLY avoids the write block.
Fires on
VACUUM FULL orders;Do this instead
Plain VACUUM (ANALYZE) reclaims space for reuse with no exclusive lock — it is almost always what was wanted. Rebuild specific indexes online with REINDEX ... CONCURRENTLY (Postgres 12+). If the table itself is genuinely bloated, pg_repack rebuilds it online; VACUUM FULL and CLUSTER belong in maintenance windows only.
VACUUM (ANALYZE) orders; -- no exclusive lock, frees space for reuse
-- index bloat, own migration outside a transaction (PG12+):
-- REINDEX INDEX CONCURRENTLY idx_orders_region;
-- table bloat: pg_repack rebuilds online without ACCESS EXCLUSIVE This rule runs locally in the free CLI — or with the full corpus through the hosted service: npx bolvrk check migration.sql