Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Time-series database implementation for metrics, IoT, financial data, and observability backends. Use when building dashboards, monitoring systems, IoT platforms, or financial applications. Covers TimescaleDB (PostgreSQL), InfluxDB, ClickHouse, QuestDB, continuous aggregates, downsampling (LTTB), and retention policies.
.claude/skills/ancoleman-using-timeseries-databases/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 62% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 58% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 60% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 54% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 62% | 0% |
Implement efficient storage and querying for time-stamped data (metrics, IoT sensors, financial ticks, logs).
Choose based on primary use case:
TimescaleDB - PostgreSQL extension
InfluxDB - Purpose-built TSDB
ClickHouse - Columnar analytics
QuestDB - High-throughput IoT
Automatic time-based partitioning:
sqlCREATE TABLE sensor_data ( time TIMESTAMPTZ NOT NULL, sensor_id INTEGER NOT NULL, temperature DOUBLE PRECISION, humidity DOUBLE PRECISION ); SELECT create_hypertable('sensor_data', 'time');
Benefits:
Pre-computed rollups for fast dashboard queries:
sql-- TimescaleDB: hourly rollup CREATE MATERIALIZED VIEW sensor_data_hourly WITH (timescaledb.continuous) AS SELECT time_bucket('1 hour', time) AS hour, sensor_id, AVG(temperature) AS avg_temp, MAX(temperature) AS max_temp, MIN(temperature) AS min_temp FROM sensor_data GROUP BY hour, sensor_id; -- Auto-refresh policy SELECT add_continuous_aggregate_policy('sensor_data_hourly', start_offset => INTERVAL '3 hours', end_offset => INTERVAL '1 hour', schedule_interval => INTERVAL '1 hour');
Query strategy:
Automatic data expiration:
sql-- TimescaleDB: delete data older than 90 days SELECT add_retention_policy('sensor_data', INTERVAL '90 days');
Common patterns:
Use LTTB (Largest-Triangle-Three-Buckets) algorithm to reduce points for charts.
Problem: Browsers can't smoothly render 1M points Solution: Downsample to 500-1000 points preserving visual fidelity
sql-- TimescaleDB toolkit LTTB SELECT time, value FROM lttb( 'SELECT time, temperature FROM sensor_data WHERE sensor_id = 1', 1000 -- target number of points );
Thresholds:
Time-series databases are the primary data source for real-time dashboards.
Query patterns by component:
| Component | Query Pattern | Example | |-----------|---------------|---------| | KPI Card | Latest value | SELECT temperature FROM sensors ORDER BY time DESC LIMIT 1 | | Trend Chart | Time-bucketed avg | SELECT time_bucket('5m', time), AVG(cpu) GROUP BY 1 | | Heatmap | Multi-metric window | SELECT hour, AVG(cpu), AVG(memory) GROUP BY hour | | Alert | Threshold check | SELECT COUNT(*) WHERE cpu > 80 AND time > NOW() - '5m' |
Data flow:
Auto-refresh intervals:
For implementation guides, see:
references/timescaledb.md - Setup, tuning, compressionreferences/influxdb.md - InfluxQL/Flux, retention policiesreferences/clickhouse.md - MergeTree engines, clusteringreferences/questdb.md - Line Protocol, SIMD optimizationFor downsampling implementation:
references/downsampling-strategies.md - LTTB algorithm, aggregation methodsFor examples:
examples/metrics-dashboard-backend/ - TimescaleDB + FastAPIexamples/iot-data-pipeline/ - InfluxDB + Go for IoTFor scripts:
scripts/setup_hypertable.py - Create TimescaleDB hypertablesscripts/generate_retention_policy.py - Generate retention policiesBatch inserts:
| Database | Batch Size | Expected Throughput | |----------|------------|---------------------| | TimescaleDB | 1,000-10,000 | 100K-1M rows/sec | | InfluxDB | 5,000+ | 500K-1M points/sec | | ClickHouse | 10,000-100,000 | 1M-10M rows/sec | | QuestDB | 10,000+ | 4M+ rows/sec |
Rule 1: Always filter by time first (indexed)
sql-- BAD: Full table scan SELECT * FROM metrics WHERE metric_name = 'cpu'; -- GOOD: Time index used SELECT * FROM metrics WHERE time > NOW() - INTERVAL '1 hour' AND metric_name = 'cpu';
Rule 2: Use continuous aggregates for dashboard queries
sql-- BAD: Aggregate 1B rows every dashboard load SELECT time_bucket('1 hour', time), AVG(cpu) FROM metrics WHERE time > NOW() - INTERVAL '30 days' GROUP BY 1; -- GOOD: Query pre-computed rollup SELECT hour, avg_cpu FROM metrics_hourly WHERE hour > NOW() - INTERVAL '30 days';
Rule 3: Downsample for visualization
typescript// Request optimal point count const points = Math.min(1000, chartWidth); const query = `/api/metrics?start=${start}&end=${end}&points=${points}`;
DevOps Monitoring → InfluxDB or TimescaleDB
IoT Sensor Data → QuestDB or TimescaleDB
Financial Tick Data → QuestDB or ClickHouse
User Analytics → ClickHouse
Real-time Dashboards → Any TSDB + Continuous Aggregates
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-05 | pass→pass | 17,634 | 16,251 | -8% | 1 | 1 | 0% | 2,661 | 4,388 | +65% | 0 | 0 | — |
case-02 | fail→pass | 19,025 | 18,417 | -3% | 1 | 1 | 0% | 3,221 | 5,204 | +62% | 0 | 0 | — |
case-12 | pass→pass | 15,783 | 16,333 | +3% | 1 | 1 | 0% | 2,812 | 4,615 | +64% | 0 | 0 | — |
case-03 | pass→pass | 13,184 | 12,585 | -5% | 1 | 1 | 0% | 2,120 | 3,942 | +86% | 0 | 0 | — |
case-01 | fail→fail | 24,727 | 25,771 | +4% | 1 | 1 | 0% | 4,211 | 6,350 | +51% | 0 | 0 | — |
case-04 | pass→pass | 23,843 | 24,863 | +4% | 1 | 1 | 0% | 4,199 | 6,276 | +49% | 0 | 0 | — |
case-06 | pass→pass | 16,424 | 12,291 | -25% | 1 | 1 | 0% | 2,707 | 3,979 | +47% | 0 | 0 | — |
case-07 | fail→pass | 14,066 | 11,430 | -19% | 1 | 1 | 0% | 2,294 | 3,617 | +58% | 0 | 0 | — |
case-08 | fail→pass | 13,599 | 11,058 | -19% | 1 | 1 | 0% | 2,264 | 3,616 | +60% | 0 | 0 | — |
case-09 | pass→pass | 8,664 | 4,405 | -49% | 1 | 1 | 0% | 1,636 | 2,595 | +59% | 0 | 0 | — |
case-10 | pass→pass | 14,515 | 11,120 | -23% | 1 | 1 | 0% | 2,920 | 3,944 | +35% | 0 | 0 | — |
case-11 | pass→pass | 15,080 | 10,166 | -33% | 1 | 1 | 0% | 2,557 | 3,552 | +39% | 0 | 0 | — |
case-13 | fail→pass | 15,179 | 11,470 | -24% | 1 | 1 | 0% | 2,616 | 4,017 | +54% | 0 | 0 | — |
case-14 | pass→pass | 11,930 | 10,746 | -10% | 1 | 1 | 0% | 1,998 | 3,459 | +73% | 0 | 0 | — |
case-15 | pass→pass | 11,275 | 7,864 | -30% | 1 | 1 | 0% | 1,996 | 3,111 | +56% | 0 | 0 | — |
case-16 | pass→pass | 7,887 | 7,076 | -10% | 1 | 1 | 0% | 1,439 | 3,108 | +116% | 0 | 0 | — |
case-17 | fail→pass | 14,160 | 11,965 | -16% | 1 | 1 | 0% | 2,404 | 3,898 | +62% | 0 | 0 | — |
case-18 | fail→pass | 17,799 | 11,693 | -34% | 1 | 1 | 0% | 3,073 | 3,816 | +24% | 0 | 0 | — |
case-19 | fail→pass | 15,981 | 11,940 | -25% | 1 | 1 | 0% | 3,026 | 3,840 | +27% | 0 | 0 | — |
case-20 | pass→pass | 15,363 | 10,737 | -30% | 1 | 1 | 0% | 2,423 | 3,673 | +52% | 0 | 0 | — |
case-21 | fail→fail | 16,399 | 13,946 | -15% | 1 | 1 | 0% | 2,721 | 4,260 | +57% | 0 | 0 | — |
case-22 | fail→pass | 15,482 | 13,755 | -11% | 1 | 1 | 0% | 2,487 | 4,030 | +62% | 0 | 0 | — |
case-23 | fail→pass | 20,349 | 15,438 | -24% | 1 | 1 | 0% | 3,242 | 4,473 | +38% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +39 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.