Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/python-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,16 @@ You can optimize your database by running VACUUM against it like so:

Database("my_database.db").vacuum()

Running VACUUM (or other operations that rebuild the database, such as :ref:`table.extract() <python_api_extract>`) against a very large database may fail with ``OperationalError: database or disk is full`` when ``/tmp`` does not have enough space for the temporary rebuild. SQLite uses a temporary file by default; you can ask it to use memory instead by setting `PRAGMA temp_store <https://www.sqlite.org/pragma.html#pragma_temp_store>`__ to ``MEMORY`` on the connection:

.. code-block:: python

db = Database("my_database.db")
db.execute("PRAGMA temp_store = MEMORY")
db.vacuum()

This makes SQLite hold the temporary state in RAM, which avoids the ``/tmp`` size limit at the cost of additional memory usage.

.. _python_api_wal:

WAL mode
Expand Down
Loading