wal_autocheckpoint
WAL size, in pages, at which a commit triggers an automatic checkpoint; 0 or less disables it.
- Par défaut
1000 pages- Range
- Any integer; 0 or negative disables
- Restart needed
- Non
- Default checked on
- SQLite 3.5x
Ce que cela fait
A checkpoint copies WAL content back into the database file. It can only finish up to the oldest active reader, so a long-running read lets the WAL grow without bound.
Valeur par défaut
1000 pages. 1000 pages, about 4MB with 4KB pages (a stock SQLite 3.5x build).
Check the current value
PRAGMA wal_autocheckpoint;
Change it
PRAGMA wal_autocheckpoint = 10000; -- this connection only
No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When to change it
Raise it for bursty write loads; disable it only if your application runs PRAGMA wal_checkpoint(TRUNCATE) itself.
What can go wrong
With checkpoints disabled or blocked by readers, the -wal file keeps growing and reads get slower.
The closest setting on other engines
| Moteur | Paramètre | Par défaut | Restart |
|---|---|---|---|
| SQLite |
wal_autocheckpoint this page
|
1000 pages |
Non |
| PostgreSQL |
max_wal_size
|
1GB |
Non |
| MySQL |
innodb_redo_log_capacity
|
100MB |
Non |
| SQL Server |
TARGET_RECOVERY_TIME
|
60 SECONDS |
Non |
| Oracle |
fast_start_mttr_target
|
0 |
Non |
Questions about wal_autocheckpoint
What is the default value of wal_autocheckpoint in SQLite?
1000 pages. 1000 pages, about 4MB with 4KB pages (a stock SQLite 3.5x build).
Does changing wal_autocheckpoint require a restart?
No. No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When should I change wal_autocheckpoint?
Raise it for bursty write loads; disable it only if your application runs PRAGMA wal_checkpoint(TRUNCATE) itself.
Back to all SQLite settings, or check the SQLite manual for every option.
Check wal_autocheckpoint on your own server
SQLly runs the query above against SQLite and the other engines in this reference, from one desktop app on macOS, Windows and Linux.