Create CAGG

PHOTO EMBED

Fri Apr 29 2022 11:28:25 GMT+0000 (UTC)

Saved by @luke #sql

CREATE MATERIALIZED VIEW conditions_summary_daily
WITH (timescaledb.continuous) AS
SELECT device,
   time_bucket(INTERVAL '1 day', time) AS bucket,
   AVG(temperature),
   MAX(temperature),
   MIN(temperature)
FROM conditions
GROUP BY device, bucket;
content_copyCOPY