mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-25 10:24:32 +02:00
'sqlite-utils enable-counts' command, closes #214
This commit is contained in:
parent
de08096989
commit
ce042ff1f0
3 changed files with 84 additions and 0 deletions
17
docs/cli.rst
17
docs/cli.rst
|
|
@ -1057,6 +1057,23 @@ Use the ``--sql`` option to output the SQL that would be executed, rather than r
|
|||
order by
|
||||
[documents_fts].rank
|
||||
|
||||
.. _cli_enable_counts:
|
||||
|
||||
Enabling cached counts
|
||||
======================
|
||||
|
||||
``select count(*)`` queries can take a long time against large tables. ``sqlite-utils`` can speed these up by adding triggers to maintain a ``_counts`` table, see :ref:`python_api_enable_counts`.
|
||||
|
||||
The ``sqlite-utils enable-counts`` command can be used to configure these triggers, either for every table in the database or for specific tables.
|
||||
|
||||
::
|
||||
|
||||
# Configure triggers for every table in the database
|
||||
$ sqlite-utils enable-counts mydb.db
|
||||
|
||||
# Configure triggers just for specific tables
|
||||
$ sqlite-utils enable-counts mydb.db table1 table2
|
||||
|
||||
.. _cli_vacuum:
|
||||
|
||||
Vacuum
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue