ANALYZE

Analyze indexes to optimize queries

Synopsis:

 ANALYZE [database-name .] [table-name] 

Description:

The ANALYZE command gathers index statistics and stores them in a special database table where the query optimizer can use them to make better index choices. If no arguments are given, all indexes in all attached databases are analyzed. If a database name is given as the argument, all indexes in that database are analyzed. If the argument is a table name, then only indexes associated with that table are analyzed.

The database-name parameter can be the name of any attached database. Supplying the names of non-attached databases isn't mandatory; if you do, use main.

The initial implementation stores all statistics in a single table named sqlite_stat1. Future enhancements may create additional tables with the same name pattern except with the 1 changed to a different digit. The sqlite_stat1 table can't be erased by the DROP TABLE command, but all its content can be deleted with the DELETE statement, which has the same effect.