feat(daemon): _signals table retention policy #152

Closed
opened 2026-04-27 05:34:19 +00:00 by xiaomo · 0 comments
Owner

Background

PR #150 introduced auto-persist signals to per-sense SQLite DB (_signals table). Currently the table grows unbounded.

Problem

Long-running senses (e.g. cpu-usage at 5s interval) will accumulate rows indefinitely, eventually impacting disk usage and query performance.

Proposal

Add a retention mechanism, e.g.:

  • Max rows: keep last N rows per sense (e.g. 10,000), prune on insert or periodically
  • TTL: delete rows older than X (e.g. 7 days)
  • Configurable: let sense config specify retention field

Simplest first step: periodic DELETE FROM _signals WHERE timestamp < ? in the worker loop.

Ref

## Background PR #150 introduced auto-persist signals to per-sense SQLite DB (`_signals` table). Currently the table grows unbounded. ## Problem Long-running senses (e.g. `cpu-usage` at 5s interval) will accumulate rows indefinitely, eventually impacting disk usage and query performance. ## Proposal Add a retention mechanism, e.g.: - **Max rows**: keep last N rows per sense (e.g. 10,000), prune on insert or periodically - **TTL**: delete rows older than X (e.g. 7 days) - **Configurable**: let sense config specify `retention` field Simplest first step: periodic `DELETE FROM _signals WHERE timestamp < ?` in the worker loop. ## Ref - PR #150
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#152