back to TILs

SQLite Connection Configuration

These notes are basically cribbed from Ben Johnson’s excellent “Building Production Applications Using Go & SQLite” GopherCon talk, specifically the “Configuring SQLite” section.

Generally speaking, you’ll want to set three PRAGMAs on each SQLite connection:

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

In turn,


Update(2024-06-30): A more complete discussion of these settings and more can be found over at kerkour.com/sqlite-for-servers