SQLite Forum

Growing WAL-File
Login
You did not describe your transactions in much detail.  Note that if you have a single thread of execution performing updates / selects, then, unless you have left a transaction hanging open (failed to run a statement until it returns SQLITE_DONE) then the maximum size of the WAL file is roughly bounded by the number of pages specified for the auto checkpoint size plus the size of the last transaction (in pages) to have ever triggered an auto checkpoint in the current session.

If, however, you are using multiple threads of execution (which includes multiple processes) then it is mayhaps a possibility that there is no time at which (a) an auto checkpoint occurs and (b) there are no transactions in progress, which will cause the WAL file to increase in size forever since it might never be able to checkpoint to the last page in the log.  

In any case, this may lead to very large WAL files even though only a small portion of the WAL pages are in use.

You may use the `pragma journal_size_limit` to force the truncation of the WAL file to a specific size whenever a checkpoint (or auto checkpoint) succeeds in clearing (resetting) the log in order to limit the size of the residual file.  Normally, the WAL file is re-cycled (overwritten) when reset and is not truncated so it will stay at the maximum size used during a session for the entire session even if the condition which caused the massive growth was transient.