-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EPIC] Improve aggregate performance with adaptive sizing in accumulators / avoiding reallocations in accumulators #7065
Comments
It seems like deque in cpp ? |
I think @yjshen meant something like storing the values in And when more space was needed, create a new |
We (Coralogix) may want to tackle this but combine with |
Using statistics to improve the allocation performance certainly seems like a good idea -- though I am not sure the default distinct statistics are very reliable |
take |
Working on an poc for performance improvement which is related to this. |
UPDATE: Now that @Rachelint has begun work on #11931 I turned this ticket into an "epic" (aka I'll link related tasks here)
Is your feature request related to a problem or challenge?
Making aggregations fast in datafusion helps its adoption and makes it even cooler
As part of the new #6904 work, @yjshen had an idea #6800 (comment) that could avoid a copy in the accumulator implementations:
Describe the solution you'd like
Adaptive sizing(perhaps?): How would the hash table header and states in each accumulator initialize and grow their sizes afterward?
Here is the structure of the current group operator
The implementation of this, such as Average is to use a
Vec<T>
. While this approach is simple to implement, it also means that as the Vec grows, the accumulated vales may be copied (up to 2 times on average, given a doubling strategy)An alternate, suggested by @yjshen is to segment the state into fixed-sized vectors, allocate a new vector at a time, fill it until full, then create a new vector for upcoming new states.
Thru this segmented approach, we could avoid memory copy for each resize, which the number of resizing would be great for high cardinality aggs, and grows the size more predictably.
But admittedly, this approach would also bring complexity for both header pointer management and update span multiple vectors.
Implementation Steps:
The text was updated successfully, but these errors were encountered: