Previously the aggregateWindow() function was written in Flux. Now it’s implemented in native Go for specific functions. This change means that the aggregateWindow() function will be even more performant if you’re using it to calculate the following aggregations:
@scott@Anaisdg I don’t think this is correct. Having min, max, first, or last as the aggregation function in aggregateWindow is orders of magnitude slower than sum, mean or count. I’ve tested this on a current InfluxDB docker image (v2.7.10). It can also be seen in profiling (mean vs max):
The performance of those functions might be affected by the amount of data being queried.
But it could still be a pushdown and not be as performant as some of the others. Being able to execute fast scans across datasets and get things like min and max is a long known pain point of v2 though, this is one contributing factor to the rewrite in v3. Is to address problematic
queries exactly like this.
I would also add that min, max, first, and last are all selector functions that have to evaluate rows against all other rows in the table(s) they operate on, so they are more compute-heavy. sum, mean, and count are all aggregate queries where the computation is simpler.
@neban Thanks for the profiler output. Could you also provide the queries your running to get these profiles? Also, what version of InfluxDB are you using?