Skip to main content

require-concurrent-reindex

problem​

REINDEX without CONCURRENTLY requires an ACCESS EXCLUSIVE lock on the index's table, blocking reads and writes.

solution​

Use REINDEX ... CONCURRENTLY.

Instead of:

-- blocks reads and writes
reindex table foo;
reindex index foo_idx;

Use:

-- avoids blocking reads and writes
reindex table concurrently foo;
reindex index concurrently foo_idx;