Enterprise only
Use REINDEX to rebuild an index over a table’s current rows while retaining
its name, indexed column, type, and supported build options. The existing index
continues serving queries until its replacement is committed.
ON <table>. Quote names
that contain punctuation, such as REINDEX INDEX `Index.Name` ON events.
Table names follow the usual database and namespace qualification rules.
The caller needs table OWNERSHIP, the same privilege as CREATE INDEX.
The result has the same result and job_id columns as CREATE INDEX, with
one row per rebuilt or scheduled index. The result names the index. Deferred
builds return their job IDs; synchronous builds return a null job_id.
Scheduling a build does not mean it has completed.
Supported build options
REINDEX recovers settings from every existing index segment before starting
any builds. It supports B-tree indexes with the standard zone size, bitmap,
label-list, FM, and NGram indexes, and MinHash indexes using the standard
tokenizer. MinHash hash count, band count, and shingle size are preserved.
NGram and MinHash rebuilds require deferred index creation through the Job
Registry, as CREATE INDEX does for those types.
Rebuilding other types, including vector, full-text, ZoneMap, Bloom filter, and
R-tree indexes, returns an error: their complete settings cannot currently be
replayed through this SQL path. Custom B-tree zone sizes and MinHash tokenizers,
covering indexes, and inconsistent settings across segments also return an
error. Specify the build options explicitly with CREATE INDEX to replace
these indexes. REINDEX never silently substitutes default settings.
REINDEX TABLE skips system-managed indexes. Naming a system-managed index
explicitly returns an error. A table without user indexes returns no result
rows. If any selected index has unsupported settings, the statement fails
before rebuilding or scheduling any index. Builds are submitted separately;
an execution failure after submission can leave earlier builds running.
REINDEX DATABASE, REINDEX SCHEMA, and CONCURRENTLY are unsupported.
Example
id_idx covers all four rows. Naming an index
that does not exist returns an error.