> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lancedb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Rebuild indexes

> Rebuild an existing index or the indexes on a table with SQL.

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.

```sql theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
REINDEX INDEX id_idx ON events;
REINDEX INDEX id_idx ON analytics.team.events;
REINDEX TABLE events;
```

The index name is a single identifier followed by `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

```sql theme={"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}}
CREATE TABLE events (id BIGINT, v STRING);
INSERT INTO events VALUES (1, 'a'), (2, 'b'), (3, 'c');
CREATE INDEX id_idx ON events USING btree (id);
INSERT INTO events VALUES (4, 'd');
REINDEX INDEX id_idx ON events;
SHOW INDEXES FOR TABLE events;
```

After the rebuild completes, `id_idx` covers all four rows. Naming an index
that does not exist returns an error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.