Does InfluxQL (3.0) support something like aggregateWindow?

Our team is considering migrating to InfluxDB 3.0, which would likely entail redoing all of our flux-based queries (in Grafana dashboards, as well as miscellaneous tools/scripts) in InfluxQL.Many (most?) of our queries rely on the aggregateWindow function in flux – in particular, we often need to use that to limit the size of the results when plotting data in Grafana – is that a feature supported in InfluxQL? How does one build a query that can cover a long time range while avoiding exceeding size constraints in plotting tools?

@Phil_Lundeen InfluxQL does include this functionality. In fact, the Flux aggregateWindow() operation was designed to replicate the functionality of InfluxQL. In InfluxQL, you group data by time and specify a duration for each time window. For example, the following Flux query:

from(bucket: "example-bucket")
  |> range(start: -1d)
  |> filter(fn: (r) => r._measurement == "home" )
  |> filter(fn: (r) => r._field == "temp" or r._field == "hum")
  |> aggregateWindow(fn: mean, every: 1h)

Would look like this in InfluxQL:

SELECT
  MEAN(temp),
  MEAN(hum)
FROM
  "example-bucket"..home
WHERE
  time > now() - 1d
GROUP BY
  time(1h)
1 Like