Skip to content

Figure out database storage size management #1

Closed

Description

@neoromantic

We store all messages and contacts in sqlite db, which probably can grow very large.

We want to store all of the messages for whole account history, but still be able to query it fast and keep disk usage reasonably low.

At least, we need to deal with the situation of high disk usage.

Maybe, just cap and remove unused cache?

Activity

  1. neoromantic commented on Oct 21, 2026

    @neoromantic
    OwnerAuthor

    Checked on 2026-10-21: nothing caps the database, runs VACUUM or sets auto_vacuum. The only pruning is of completed sync jobs.

    What grows:

    • the full raw JSON of every message;
    • message_search (FTS5), which holds a full copy of the text, sender and chat columns instead of being an external-content table;
    • messages deleted on Telegram, which are only flagged;
    • api_activity and rate_limits: their prune functions exist but have no callers;
    • failed sync jobs (see Retry failed sync jobs with backoff #9).

    A first step: show the cache size per table in tg status, prune api_activity, rate_limits and old jobs on a schedule, and add tg db vacuum. Then measure the bytes per message before deciding on an external-content FTS table and on compacting the raw JSON. This becomes urgent once backfill (#6) works.

  2. added
    enhancement
    on Oct 21, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions