1

I want to count the number of events during last 1 week from a measurement X and store the count into another measurement Y periodically using an InfluxDB CONTINUOUS QUERY. However it seems "GROUP BY time" is mandatory in the query. This results in splitting of the result into multiple time range windows. Is there a way to disable GROUP BY or specify some duration in GROUP BY that doesn't result in splitting of the result?

Continuous Query

CREATE CONTINUOUS QUERY "cq_advanced_every_for" ON "transportation"
RESAMPLE EVERY 1h FOR 7d
BEGIN
  SELECT COUNT(DISTINCT("event_name")) INTO "weekly_event_count" FROM "daily_event_count" GROUP BY time(7d)
END

Query

SELECT * FROM weekly_event_count

Output

time                   count
----                   -----
2020-08-20T00:00:00Z   25000 -->I expected the timestamp to be 2020-08-19 as the query was run on 2020-08-26
codeseeker
  • 85
  • 2
  • 5

0 Answers0