Dev Notes

Things I learned running SQLite in production

August 29, 2026

For small services a single SQLite file is simpler to deploy, back up and reason about than a database server. A few settings made the difference for me.

PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA busy_timeout = 5000;
PRAGMA foreign_keys = ON;

WAL lets readers and a single writer work at the same time. The busy timeout turns random "database is locked" errors into short waits. Keep write transactions short and batch inserts.

For backups use the .backup command or VACUUM INTO, not a plain file copy of a live database.