TimescaleDB
Tracera uses TimescaleDB — a PostgreSQL extension purpose-built for time-series data. This gives us full SQL compatibility with automatic time-based partitioning.Why TimescaleDB?
| Feature | Benefit for Tracera |
|---|---|
| Hypertables | Automatic partitioning of price history by time |
| Continuous Aggregates | Pre-computed 1h, 24h, 7d windows without manual cron jobs |
| Retention Policies | Automated cleanup of old raw data |
| Full PostgreSQL | SQL joins, indexes, constraints — no new query language |
Hypertables
Theprice_history table is converted to a hypertable:
Continuous Aggregates
Pre-computed materialized views that refresh automatically:| View | Bucket Size | Use Case |
|---|---|---|
price_1h | 1 hour | Short-term volatility, intraday analysis |
price_24h | 24 hours | Daily trends, day-over-day comparison |
price_7d | 7 days | Weekly trends, longer-term analysis |
Refresh Policies
Continuous aggregates are configured with automated refresh policies so they stay up-to-date without manual intervention.Retention Policies
Raw price data is retained for a configurable period. Continuous aggregates are retained indefinitely, preserving historical analysis capability while keeping database size manageable.Connection Configuration
pgxpool for connection pooling, avoiding connection-per-request overhead.