All rules Rule BV003
warning
free in the CLI

Non-concurrent index creation

Warning — this works, but blocks traffic or rewrites data at scale.

What it catches

CREATE INDEX holds a SHARE lock for the entire build, blocking INSERT/UPDATE/DELETE on the table. Build time scales with table size, so a migration that is instant in dev blocks writes for minutes in production.

Fires on

CREATE INDEX idx_orders_region ON orders (region);

Do this instead

Build the index with CREATE INDEX CONCURRENTLY in its own migration, outside any transaction. It takes only SHARE UPDATE EXCLUSIVE, so writes continue during the build. It can fail and leave an INVALID index — drop it and retry rather than ignoring it.

-- In its own migration file, run outside a transaction:
CREATE INDEX CONCURRENTLY idx_orders_region ON orders (region);
Catch this before it ships

This rule runs locally in the free CLI — or with the full corpus through the hosted service: npx bolvrk check migration.sql