Rolling window (sum) queries with InfluxDb3

Hello, Im trying to do a rolling sum over the last hour of my data points. I want this sum to be calculated on every data point. Even once every second would be ok.

But I searched around and apparently the second option is only possible with Flux, which isnt supported in InfluxDb3?

I thought this would be a very common use case.

Since you quoted my post, here is what I came up with in InfluxQL:

SELECT sum("RainCorrDiff") FROM "coop_garden_calc" WHERE ("deviceName"::tag = 'Mitwirkgarten-Barani-MeteoHelix-1') AND $timeFilter GROUP BY time(1d)

This gives me the amount of rain fall per day. If you put GROUP BY time(1h) it may give you (to be honest I’m not sure) what you want?

1 Like

@cortlieb thanks so much for sharing your InfluxQL solution!

This solution gives the sum over the last hour, at specified time intervals 1:00-2:00, 2:00-3:00, etc.

It’s not bad, but what I’m looking for is 1:00-2:00, 1:01-2:01, 1:02-2:02, etc… a rolling window of 1 hr computed every minute. Looks like this is possible with Flux.

Even better though, I’d like the last 1hr computed at every data point… ex. 1:00-2:00, 1:03-2:03, 1:04.50-2:04.50, etc.

I’m surprised because I’d think rolling window was a very common query type.