influxdata / influxdata/influxdb
Why is the query so slow after adding the timezone?
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
In influxdb2.2 OSS:
for example
this query is fast:
from(bucket: "test")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "record_raw_data")
|> filter(fn: (r) => r["_field"] == "accessTime")
|> aggregateWindow(every: 24h, fn: count, createEmpty: false)
|> yield(name: "count")
but this query is too slow(More than 300 times slower):
import "timezone"
option location = timezone.location(name:"Asia/Shanghai")
from(bucket: "test")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "record_raw_data")
|> filter(fn: (r) => r["_field"] == "accessTime")
|> aggregateWindow(every: 24h, fn: count, createEmpty: false)
|> yield(name: "count")
How can I split the query time in the correct timezone in an acceptable time?
Contributor guide
Research direction
Start by reproducing the two Flux queries against InfluxDB 2.2 OSS, comparing execution time with and without the timezone.location option. Investigate the timezone import and aggregateWindow behavior; done means identifying the cause of the slowdown and documenting or implementing an acceptable timezone-aware query path.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100