Skip to content

Compress snapshot state.db to cut disk usage #147

Closed

Description

@frahlg

Observed

First snapshot on a mature system landed at 198 MB (v0.31.0 on a site with 30 days of hot-tier telemetry + long-format TS). Five-slot retention ⇒ ~1 GB of snapshots on disk. Fine on a typical RPi install with a 32 GB card, less fine on smaller setups or when operators keep history longer.

Fix

Pipe `VACUUM INTO` output through gzip before writing. SQLite has a good compression ratio on the hot-tier tables (lots of repeated column headers, small numeric deltas) — expect 5-10×.

Two approaches:

  1. Sidecar-free: run `VACUUM INTO` to a temp `.db`, then gzip it into the snapshot dir, remove temp. Two steps but no driver dependency.
  2. SQLite VFS / in-memory compress: more invasive.

Preference: (1). Sufficient and self-contained.

Rollback reads the gzip transparently — update `restore` path (tracked in #140 phase 2) to `gunzip` before `docker compose stop` + file swap.

Scope

Follow-up to #141. Targeting Phase 2 rollback bundle so the compression + decompression paths ship together.

Activity

  1. frahlg commented on Jul 11, 2026

    @frahlg
    MemberAuthor

    Implemented by bd4af1f: pre-update state.db snapshots are gzip-compressed and rollback handles the compressed snapshot format.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions