mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-24 18:04:32 +02:00
sqlite-utils analyze command, refs #379
This commit is contained in:
parent
389cbd5792
commit
e0ef9288fe
4 changed files with 76 additions and 1 deletions
17
docs/cli.rst
17
docs/cli.rst
|
|
@ -1800,6 +1800,23 @@ If the ``_counts`` table ever becomes out-of-sync with the actual table counts y
|
|||
|
||||
$ sqlite-utils reset-counts mydb.db
|
||||
|
||||
.. _cli_analyze:
|
||||
|
||||
Optimizing index usage with ANALYZE
|
||||
===================================
|
||||
|
||||
The `SQLite ANALYZE command <https://www.sqlite.org/lang_analyze.html>`__ builds a table of statistics which the query planner can use to make better decisions about which indexes to use for a given query.
|
||||
|
||||
You should run ``ANALYZE`` if your database is large and you do not think your indexes are being efficiently used.
|
||||
|
||||
To run ``ANALYZE`` against every index in a database, use this::
|
||||
|
||||
$ sqlite-utils analyze mydb.db
|
||||
|
||||
You can run it against specific tables, or against specific named indexes, by passing them as optional arguments::
|
||||
|
||||
$ sqlite-utils analyze mydb.db mytable idx_mytable_name
|
||||
|
||||
.. _cli_vacuum:
|
||||
|
||||
Vacuum
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue