InfluxQL vs Flux performance on Influx 1.8

I have been using both Flux and InfluxQL recently, comparing which is faster and how to query using both efficiently. I noticed a pretty significant difference in performance between Flux and InfluxQL and was wondering if there is an explanation for it.

This InfluxQL call on a 1.8 runs in less than a second:
SELECT last(“Value”) AS “mean_Value” FROM “MonitoringDB”.“autogen”.“Neurio.TotalConsuption.Power”

whereas this Flux call on a 1.8 server runs in ~10 seconds:
from(bucket: “MonitoringDB/autogen”)
|> range(start: 0)
|> filter(fn: (r) => r["_measurement"] == “Neurio.TotalConsuption.Power”)
|> filter(fn: (r) => r[“EngUnit”] == “Watts”)
|> filter(fn: (r) => r["_field"] == “Value”)
|> last()
|> yield(name: “last”)

They are essentially the same query. Is this something that has been fixed and is there an explanation for why this occurs?

Hello,

The performance of this kind of query has indeed been fixed in InfluxDB 2. In InfluxDB 2, the last function is covered by a pushdown, which makes the query run much faster when using flux and should be comparable to the InfluxQL query performance.

1 Like