journal_size_limit
Bytes of WAL or journal file kept on disk after a checkpoint or commit; -1 keeps everything.
- Predeterminado
-1 (no limit)- Range
- -1, or 0 and up in bytes
- Restart needed
- No
- Default checked on
- SQLite 3.5x
Lo que hace
Without a limit, the -wal file stays at its largest size after a checkpoint resets it (it is reused, not shrunk).
Valor predeterminado
-1 (no limit). -1 (a stock SQLite 3.5x build). The sqlite3 shipped with macOS reports 32768.
Check the current value
PRAGMA journal_size_limit; SELECT * FROM pragma_journal_size_limit; -- table-valued form, usable in queries
Change it
PRAGMA journal_size_limit = 67108864; -- 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
On devices with little disk space or when one large transaction left a huge -wal file.
What can go wrong
Truncating and regrowing the file costs some I/O.
Questions about journal_size_limit
What is the default value of journal_size_limit in SQLite?
-1 (no limit). -1 (a stock SQLite 3.5x build). The sqlite3 shipped with macOS reports 32768.
Does changing journal_size_limit 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 journal_size_limit?
On devices with little disk space or when one large transaction left a huge -wal file.
Back to all SQLite settings, or check the SQLite manual for every option.
Check journal_size_limit 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.