I have a simple query that I cannot make it to perform well. I just want to query the latests n elements from a measurement, so the user can see the most recent entries on its data (not bounded by time). I think it worked fine on Influx1, but I am struggling to get similar results on Influx2.
At this moment, I have a measurement called
monitoring, with some millions of entries. The following query takes more than 3 seconds to complete, which I think it is not performing fine.
import "json" from(bucket: "alvarolb") |> range(start: 0, stop: now()) |> filter(fn: (r) => r._measurement == "monitoring") |> top(n: 100, columns: ["_time"])
I have tried
sort and then
limit, but it is practically the same.