Skip to content
ParticleDB
Release candidateParticleDB 1.1.19-rc.17 is not yet GA or ready for production data.Release status →

Time-series queries

Store timestamped records and summarize them with ordinary SQL.

CREATE TABLE docs_readings (id BIGINT PRIMARY KEY, measured_at TIMESTAMP, value BIGINT);
INSERT INTO docs_readings VALUES
(1, '2026-01-01 12:10:00', 10),
(2, '2026-01-01 12:20:00', 30);
SELECT DATE_TRUNC('hour', measured_at) AS hour, AVG(value) AS mean
FROM docs_readings GROUP BY DATE_TRUNC('hour', measured_at)
ORDER BY hour;

Both readings fall in the same hour and have a mean of 20. Define your timezone and missing-data policy explicitly. A missing interval is different from a zero-valued measurement. Plan retention as an application or operational policy rather than assuming rows expire automatically.

SQL reference · Application guide · Troubleshooting