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

# REINDEX

> Rebuild indexes from scratch

# REINDEX

The REINDEX statement deletes and recreates indexes from scratch. It is useful when a collation sequence definition has changed, or to rebuild an index that may have become out of date.

## Syntax

```sql theme={null}
REINDEX;
REINDEX collation-name;
REINDEX [schema-name.]table-name;
REINDEX [schema-name.]index-name;
```

## Description

| Form                     | Description                                                |
| ------------------------ | ---------------------------------------------------------- |
| `REINDEX`                | Rebuild all indexes in all attached databases              |
| `REINDEX collation-name` | Rebuild every index that uses the named collation sequence |
| `REINDEX table-name`     | Rebuild all indexes associated with the named table        |
| `REINDEX index-name`     | Rebuild the named index                                    |

When a single unqualified name is given, Turso resolves it in the order **collation → table → index**: if the name matches a collation sequence, all indexes using that collation are rebuilt; otherwise it is treated as a table or index name.

## Examples

```sql theme={null}
-- Rebuild every index in the database
REINDEX;

-- Rebuild all indexes on a table
REINDEX orders;

-- Rebuild a single index
REINDEX idx_customer;

-- Rebuild all indexes that use a collation
REINDEX NOCASE;
```

## Limitations

REINDEX returns an error in the following cases:

* When the connection is in MVCC mode (`journal_mode=mvcc`).
* On `WITHOUT ROWID` tables.
* For custom index methods that have no backing B-tree, such as FTS and vector indexes.
* When `PRAGMA query_only` is enabled.

## See Also

* [CREATE INDEX](/sql-reference/statements/create-index) for creating indexes
* [DROP INDEX](/sql-reference/statements/drop-index) for removing indexes
* [ANALYZE](/sql-reference/statements/analyze) for collecting index statistics
