105 words
1 minute
SQLite VACUUM: database or disk is full
Anubhav Gain
2024-05-18

SQLite VACUUM: database or disk is full#

I was trying to run VACUUM against a large SQLite database file (~7GB) using sqlite-utils vacuum data.db and I got this error:

sqlite3.OperationalError: database or disk is full

The /data volume that the database lived in was 20GB in size, so there should have been enough room to run the operation.

I realized that this was because VACUUM uses the /tmp directory, and on this machine that was on a separate volume that did not have enough space.

The fix was to set the SQLITE_TMPDIR environment variable to the current directory (or any directory on a volume with enough space):

SQLITE_TMPDIR=/data sqlite-utils vacuum data.db
SQLite VACUUM: database or disk is full
https://mranv.pages.dev/posts/sqlite-vacuum-database-or-disk-is-full/
Author
Anubhav Gain
Published at
2024-05-18
License
CC BY-NC-SA 4.0