PRAGMA journal_mode = WAL; |
DELETE (rollback journal) |
WAL (persistent database header) |
Separates concurrent SELECT readers from the single serialized writer by appending mutations to a sequential -wal file (sqlite.org/wal.html). |
PRAGMA synchronous = NORMAL; |
FULL (2) |
NORMAL in WAL (optional FULL for strict ledgers) |
Skips per-transaction disk barriers in WAL mode while syncing -wal frames prior to checkpoints; preserves consistency across process crashes. |
PRAGMA mmap_size = <bytes>; |
0 (disabled) |
min(DB bytes, 50% VPS RAM, 32 GiB) or 0 on LiteFS |
Maps database pages directly into the process address space to avoid read() syscall copies; disabled on FUSE filesystems like LiteFS. |
PRAGMA cache_size = -<KiB>; |
-2000 (~2 MiB) |
-(VPS_RAM_MiB * 0.25 * 1024) |
Negative value sets the per-connection SQLite page heap limit in kibibytes for unmapped or dirty B-tree pages. |
PRAGMA busy_timeout = 5000; |
0 ms (immediate SQLITE_BUSY) |
3000 ms – 8000 ms (scaled by Write QPS) |
Instructs contending writers using BEGIN IMMEDIATE to sleep and retry cleanly before returning SQLITE_BUSY. |
PRAGMA wal_autocheckpoint; |
1000 pages (~4 MiB) |
0 (Litestream/LiteFS) or 2000–4000 (Standalone) |
Controls automatic passive checkpoints; set to 0 when an external WAL shipping daemon coordinates checkpoint windows. |
PRAGMA journal_size_limit; |
-1 (unbounded -wal file) |
67108864 (64 MiB) or 134217728 (128 MiB) |
Truncates the on-disk -wal file back to a bounded ceiling after every completed checkpoint or reset. |
PRAGMA temp_store = MEMORY; |
DEFAULT (0 / disk temp files) |
MEMORY (2) |
Keeps transient ORDER BY, GROUP BY, and CTE B-trees in RAM rather than writing temporary scratch files to NVMe. |