Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

REINDEX

REINDEX INDEX [ CONCURRENTLY ] name;
REINDEX [ CONCURRENTLY ] TABLE name;

Rebuilds a B-tree or GIN index from the table’s visible rows. The REINDEX TABLE form rebuilds the table’s valid indexes.

REINDEX CONCURRENTLY builds replacement indexes while the old indexes remain in use and cannot run inside a transaction block (BEGIN/COMMIT).

If a concurrent rebuild fails, the original index remains available. Because the rebuild publishes a replacement relation, the index’s internal OID may change. REINDEX reapplies the fillfactor persisted on the index. Expressions, partial indexes, and INCLUDE are outside the current index subset.