auto_vacuum
Whether free pages are returned to the OS automatically (FULL), on request (INCREMENTAL) or never (NONE).
- Par défaut
0 (NONE)- Range
- 0 NONE, 1 FULL, 2 INCREMENTAL
- Restart needed
- Non
- Default checked on
- SQLite 3.5x
Ce que cela fait
With NONE, deleted data leaves free pages inside the file until VACUUM. FULL moves pages at every commit to truncate the file; INCREMENTAL lets PRAGMA incremental_vacuum(N) do it in steps.
Valeur par défaut
0 (NONE). NONE (a stock SQLite 3.5x build).
Check the current value
PRAGMA auto_vacuum; SELECT * FROM pragma_auto_vacuum; -- table-valued form, usable in queries
Change it
PRAGMA auto_vacuum = INCREMENTAL; VACUUM; -- needed for an existing database
No restart. The value is stored in the database file, but on an existing database it only takes effect after VACUUM rebuilds the file.
When to change it
For databases on space-constrained devices that shrink after deletes. Switching between NONE and the others on an existing database requires VACUUM.
What can go wrong
FULL increases write work and fragments the file; neither mode defragments like VACUUM does.
Questions about auto_vacuum
What is the default value of auto_vacuum in SQLite?
0 (NONE). NONE (a stock SQLite 3.5x build).
Does changing auto_vacuum require a restart?
No. No restart. The value is stored in the database file, but on an existing database it only takes effect after VACUUM rebuilds the file.
When should I change auto_vacuum?
For databases on space-constrained devices that shrink after deletes. Switching between NONE and the others on an existing database requires VACUUM.
Back to all SQLite settings, or check the SQLite manual for every option.
Check auto_vacuum on your own server
SQLly runs the query above against SQLite and the other engines in this reference, from one desktop app on macOS, Windows and Linux.