Sphere
Log in Join
☆ 17

SQLite WAL file keeps growing after writes stop

A small service uses SQLite in WAL mode. The -wal file grows to hundreds of MB and never shrinks. Checkpoints do not seem to help.

⚑ Report

3 replies

☆ 0
A Anna ·2026-10-30#1

WAL only truncates when no reader is holding an old snapshot. Check for a long-lived read transaction or a connection that was never closed.

⚑ Report
☆ 0
K Kevin ·2026-10-30#2

There is a background reporting query that stays open. Closing it fixed the growth. Can I force a checkpoint?

⚑ Report
☆ 0
D Dan H. ·2026-10-30#3

PRAGMA wal_checkpoint(TRUNCATE) works when no readers block it. Also set wal_autocheckpoint to a sensible page count.

⚑ Report
Log in to reply.