Details
-
Bug
-
Resolution: Fixed
-
Major
-
2.7.0
-
Security Level: Public
Description
Today while investigating CBSE-7971 I discovered that our databases are not being created with SQLite incremental vacuum enabled, because of an undocumented ordering dependency of pragmas when setting up a new db.
This means CBL's compact() method hasn't been doing much. The SQLite call to "pragma incremental_vacuum" is a no-op. Compaction does some index optimization, and deletes unused blobs, but that's it. Free space inside the DB file is not returned to the OS.
For new databases we can correct the problem by reordering the SQLite commands that are run when a new db is initialized. Unfortunately there is no way to correct this for existing databases, because auto_vacuum can only be enabled on an empty database