// sqlite · checkpoints & recovery

wal_autocheckpoint

WAL size, in pages, at which a commit triggers an automatic checkpoint; 0 or less disables it.

По умолчанию
1000 pages
Range
Any integer; 0 or negative disables
Restart needed
Нет
Default checked on
SQLite 3.5x

Что оно делает

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.

Значение по умолчанию

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

ДвижокНастройкаПо умолчаниюRestart
SQLite wal_autocheckpoint this page 1000 pages Нет
PostgreSQL max_wal_size 1GB Нет
MySQL innodb_redo_log_capacity 100MB Нет
SQL Server TARGET_RECOVERY_TIME 60 SECONDS Нет
Oracle fast_start_mttr_target 0 Нет

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.

// one client for every engine

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.