SPB Git

Repository Public

0003-postgresql-native-timeseries.md 1.1 KB

# 0003 — PostgreSQL native partitioning instead of TimescaleDB; no Redis

Context (observed). PostgreSQL 17 (Homebrew) is present on 8 nodes; TimescaleDB is installed nowhere. Expected volume: ~29 nodes × ~25 series every 10 s ≈ 6 M rows/day.

Decision. One PostgreSQL database holds inventory, identity, actions, audit and metrics. Metrics use declarative range partitioning: samples_raw (daily partitions, 7 days), samples_1m (30 days) and samples_1h (400 days), filled by idempotent roll-up jobs driven by watermarks. Retention = dropping partitions. Coordination between services uses durable tables plus LISTEN/NOTIFY; rate limits are in-process (single API instance). Redis is not used.

Why. Building and maintaining a PostgreSQL extension on the host for this volume adds an operational dependency without need; the "or equivalent" of the mandate is met by native partitions + roll-ups. Fewer moving parts is the robust choice on a single host.

Revisit when raw ingestion exceeds ~50 M rows/day or queries need continuous aggregates beyond the two fixed tiers.

Files main
Menu

Theme