Name

journal_size_limit — Set a maximum size for released journal files

Common Usage

PRAGMA [database.]journal_size_limit;
PRAGMA [database.]journal_size_limit = max_bytes;

Description

The journal_size_limit pragma forces the partial deletion of large journal files that would otherwise be left in place. Although journal files are normally deleted when a transaction completes, if a database is set to use persistent journal mode, the journal file is simply left in place. In some situations, the journal file can also remain if the database is set to use exclusive locking mode.

If a journal size limit has been set, SQLite will take the time to examine any journal file that would normally be left in place. If the journal file is larger than max_bytes , the file is truncated to max_bytes . This keeps very larger journal files (such as those left behind from a VACUUM) from continuing to consume excessive storage space.

When first opened or attached, each database is assigned the compile-time default. This is normally ‒1, indicating that there is no limit. Each database in a database connection can be set to a different value. Databases must be set individually, even if they are all set to the same value.

Both the get and the set syntax will return the current limit.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.