Skip to content

reindex-blocking

Reindex concurrently.

Severity: error · Lock: SHARE

A plain REINDEX locks the table against writes and blocks queries that use the index while it rebuilds.

REINDEX INDEX idx_users_email;
REINDEX INDEX CONCURRENTLY idx_users_email;

REINDEX CONCURRENTLY exists from Postgres 12. On older versions, build a new index concurrently and drop the old one.

To skip this rule for one statement, put -- pgdeadbolt-ignore reindex-blocking on the line above it.