Connection pragmas in SQL
A handful of pragmas decide how a SQLite connection trades safety for speed.
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA busy_timeout = 5000;
PRAGMA cache_size = -20000;
PRAGMA optimize;
How it works
journal_mode = WALlets readers and one writer work at the same time.synchronous = NORMALis the usual WAL companion: fast, still crash-safe.busy_timeoutmakes a blocked writer wait instead of failing immediately.
The run, in numbers
- Lines
- 9
- Characters to type
- 132
- Tokens
- 24
- Three-star pace
- 95 tpm
At the three-star pace of 95 tokens a minute, this run takes about 15 seconds.
Step 5 of 5 in Transactions, step 15 of 17 in Plans & performance.