SQLite Query Language: REINDEX

Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Support |

# SQL As Understood By SQLite

[Top]

## REINDEX

#### reindex-stmt:

The REINDEX command is used to delete and recreate indices from scratch. This is useful when the definition of a collation sequence has changed.

If the REINDEX keyword is not followed by a collation-sequence or database object identifier, then all indices in all attached databases are rebuilt.

If the REINDEX keyword is followed by a collation-sequence name, then all indices in all attached databases that use the named collation sequences are recreated.

Or, if the argument attached to the REINDEX identifies a specific database table, then all indices attached to the database table are rebuilt. If it identifies a specific database index, then just that index is recreated.

If no database-name is specified and there exists both a table or index and a collation sequence of the specified name, SQLite interprets this as a request to rebuild the indices that use the named collation sequence. This ambiguity in the syntax may be avoided by always specifying a database-name when reindexing a specific table or index.