// sqlite · checkpoints & recovery

wal_autocheckpoint

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

Padrão
1000 pages
Range
Any integer; 0 or negative disables
Restart needed
Não
Default checked on
SQLite 3.5x

O que faz

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.

Valor padrão

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

MotorConfiguraçãoPadrãoRestart
SQLite wal_autocheckpoint this page 1000 pages Não
PostgreSQL max_wal_size 1GB Não
MySQL innodb_redo_log_capacity 100MB Não
SQL Server TARGET_RECOVERY_TIME 60 SECONDS Não
Oracle fast_start_mttr_target 0 Não

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.