elasticsearch/x-pack
Nik Everett 3263429a78
ESQL: Speed up VALUES for many buckets (#123073) (#123229)
* ESQL: Speed up VALUES for many buckets (#123073)

Speeds up the VALUES agg when collecting from many buckets.
Specifically, this speeds up the algorithm used to `finish` the
aggregation. Most specifically, this makes the algorithm more tollerant
to large numbers of groups being collected. The old algorithm was
`O(n^2)` with the number of groups. The new one is `O(n)`

```
(groups)
      1     219.683 ±    1.069  ->   223.477 ±    1.990 ms/op
   1000     426.323 ±   75.963  ->   463.670 ±    7.275 ms/op
 100000   36690.871 ± 4656.350  ->  7800.332 ± 2775.869 ms/op
 200000   89422.113 ± 2972.606  -> 21920.288 ± 3427.962 ms/op
 400000 timed out at 10 minutes -> 40051.524 ± 2011.706 ms/op
```

The `1` group version was not changed at all. That's just noise in the
measurement. The small bump in the `1000` case is almost certainly worth
it and real. The huge drop in the `100000` case is quite real.

* Fix

* Compile
2025-02-27 07:35:57 +11:00
..
dev-tools
libs [Gradle] Update shadow plugin (#116826) (#116877) 2024-11-16 15:06:35 +01:00
license-tools Make some practically static methods static (#97565) 2023-10-06 23:37:07 +02:00
plugin ESQL: Speed up VALUES for many buckets (#123073) (#123229) 2025-02-27 07:35:57 +11:00
qa [8.16] [Gradle] Make rolling upgrade tests configuration cache compatible (#119577) (#120317) 2025-01-30 04:07:37 +11:00
rest-resources-zip Add AGPLv3 as a supported license 2024-09-13 14:30:33 -07:00
test [ci] Add Alma Linux 9 to matrix in packaging and platform jobs (#118331) (#119315) 2024-12-28 04:39:13 +11:00
build.gradle Update Gradle wrapper to 8.12 (#118683) (#119357) 2024-12-31 08:37:28 +01:00
NOTICE.txt
README.md

Elastic License Functionality

This directory tree contains files subject to the Elastic License. The files subject to the Elastic License are grouped in this directory to clearly separate them from files licensed under the Server Side Public License, v 1.