Reference

SQLite Auto-Vacuum

SQLite Auto-Vacuum automatically reclaims space from deleted rows by shrinking the database file, instead of leaving free pages that bloat it. It helps keep app databases from growing unnecessarily over time.

APIs & internalsAndroidiOS

SQLite Auto-Vacuum

Also known as: sqlite auto vacuum, incremental vacuum, sqlite auto-vacuum, sqlite vacuum

SQLite Auto-Vacuum automatically reclaims space from deleted rows by shrinking the database file, instead of leaving free pages that bloat it. It helps keep app databases from growing unnecessarily over time.

  • Auto-Vacuum reclaims space from deleted rows so the database file does not bloat.
  • Full mode shrinks on every commit; incremental mode shrinks on demand via PRAGMA.
  • It must be set when the database is created, or a full VACUUM is needed later.

Why databases bloat

When you delete rows from a SQLite database, the freed space is normally kept inside the file as reusable empty pages rather than being returned to the operating system. Over time, an app that inserts and deletes a lot of data can leave a database file much larger than the data it actually holds.

Auto-Vacuum addresses this by moving free pages to the end of the file and truncating it, so the database file size tracks the real amount of stored data more closely.

Full vs incremental auto-vacuum

SQLite offers two modes. In full auto-vacuum, the database is shrunk automatically at every transaction commit that frees pages. In incremental auto-vacuum, free pages are tracked but only released when the app explicitly runs `PRAGMA incremental_vacuum`, giving developers control over when the cleanup cost is paid.

Auto-Vacuum must be enabled when the database is first created (via `PRAGMA auto_vacuum`); enabling it later requires a full VACUUM. Many apps leave it off and instead run a manual `VACUUM` occasionally, which rebuilds the file and compacts it but needs extra free space and time.

What it means for your storage

Without vacuuming, an app database can occupy more space than necessary, quietly inflating the app data shown in Settings > Apps. Auto-Vacuum keeps that footprint lean, which is one reason a well-built app may use less storage than a comparable one that never compacts its databases.

These databases are persistent app data, not cache, so a cleaner cannot safely shrink them for you. Cleanor instead recovers space from caches, duplicate photos, and large media, where deletion is safe.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.