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

Better vacuum behavior for offline database #4340

Closed

Description

@jfirebaugh

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.

Activity

  1. jfirebaugh commented on Mar 15, 2016

    @jfirebaugh
    ContributorAuthor

    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.

  2. jfirebaugh commented on Mar 15, 2016

    @jfirebaugh
    ContributorAuthor

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

  3. self-assigned this
    on Mar 16, 2016
  4. jfirebaugh commented on Mar 17, 2016

    @jfirebaugh
    ContributorAuthor

    Implemented in #4342.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions