Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Better vacuum behavior for offline database #4340

Closed
jfirebaugh opened this issue Mar 15, 2016 · 3 comments
Closed

Better vacuum behavior for offline database #4340

jfirebaugh opened this issue Mar 15, 2016 · 3 comments
Assignees
Labels

Comments

@jfirebaugh
Copy link
Contributor

The offline database currently has no vacuum behavior: once it reaches a certain size on disk, it will never get smaller, even if you delete offline regions. (It will however reuse emptied pages within the database.)

If the database size becomes larger than the target size set by the maximumCacheSize parameter (default 50 MB), the following warning message is printed:

Current size is larger than the maximum size. Database won't get truncated.

This behavior was inherited from the previous cache database implementation. The original reasoning was that SQLite VACUUM was an expensive operation. With offline functionality now included, it's time to revisit this decision. If you create a large offline region, and then delete it, the on disk-size should return to roughly the previous level.

One approach would be to enable auto_vacuum.

@jfirebaugh
Copy link
Contributor Author

auto_vacuum = FULL sounds ideal. However, the documentation is self-contradictory about whether or not there's a way to enable it on an existing database:

It is not possible to enable or disable auto-vacuum after a table has been created.

[...]

To change auto-vacuum modes, first use the auto_vacuum pragma to set the new desired mode, then invoke the VACUUM command to reorganize the entire database file.

@jfirebaugh
Copy link
Contributor Author

Actually PRAGMA auto_vacuum = INCREMENTAL plus PRAGMA incremental_vacuum after deleting an offline region sounds even better.

@jfirebaugh
Copy link
Contributor Author

Implemented in #4342.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant