4

I'm upgrading form influx1.x to influx2.x (updating queries from influxQL to Flux syntax). For very simple queries, performance drops dramatically when I try to query more than 500,000 points and I'm not sure if there's anything I can do to improve my queries to get better performance

InfluxQL:

select last("y") AS "y" from "mydata".autogen."profile" 
WHERE time >= '2019-01-01T00:00:00Z' and time <= '2019-01-07T23:59:59Z' 
GROUP BY time(1s) FILL(none)

Flux:

data=from(bucket: "mydata")
|> range(start: 2019-01-01T00:00:00Z, stop: 2019-01-07T23:59:59Z)
|> filter(fn: (r) => r._measurement == "profile")
|> filter(fn: (r) => r._field=="y")
|> aggregateWindow(every: 1s, fn: last, createEmpty: false)
|> yield()

any advice?

Ali Ajouz
  • 61
  • 3

1 Answers1

2

You could try rebuilding the time series index with the command below:

influxd inspect build-tsi

See more details here.

The reason behind this is while you are upgrading, the meta and data are migrated but not the indices. So "InfluxDB must build a new time series index (TSI). Depending on the volume of data present, this may take some time." according to the guide.

Munin
  • 1,576
  • 2
  • 19
  • I my case that didn't help unfortunately – DarkMath Jun 09 '22 at 09:41
  • @darkmath did you find any remedy for this? – Anish Feb 09 '23 at 22:14
  • @Anish No, unfortunately not. – DarkMath Feb 10 '23 at 05:54
  • @DarkMath, could you try turn on the profiler and see the detailed report according to these two docs ( https://docs.influxdata.com/flux/v0.x/stdlib/profiler/ and https://dganais.medium.com/tl-dr-influxdb-tech-tips-optimizing-flux-performance-in-influxdb-cloud-21de08fc50c9 )? – Munin Feb 19 '23 at 08:39