Skip to content
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

[Rust][DataFusion] Improve hash aggregate performance with large number of groups in #27200

Closed
asfimport opened this issue Jan 18, 2021 · 1 comment

Comments

@asfimport
Copy link

Currently, hash aggregates are performing well when having a small number of output groups, but the results on db-benchmark h2oai/db-benchmark#182 test on data with a high number of output groups.
#9234 improved the situation a bit, but DataFusion is still much slower than even the slowest result when comparing to the published results.

This seems mostly having to do with the way we use individual key/groups.
For each new key, we take the indices of the group, resulting in lots of small allocations and cache unfriendliness and other overhead if we have many keys with only a small (just 1-2) number of rows per group in a batch. Also the indices are converted from a Vec to an Array, making the situation worse (accounts for ~22% of the instructions on the master branch!), other profiling results seem to be from related allocations too.

To make it efficient for tiny groups, we should probably change the hash aggregate algorithm to take based on all indices from the batch in one go, and "slice" into the resulting array for the individual accumulators.
 
Here is some profiling info of the db-benchmark questions 1-5 against master:

image-2021-01-18-13-00-36-685.png

Reporter: Daniël Heres / @Dandandan
Assignee: Daniël Heres / @Dandandan

Original Issue Attachments:

PRs and other links:

Note: This issue was originally created as ARROW-11300. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Jorge Leitão / @jorgecarleitao:
Issue resolved by pull request 9271
#9271

@asfimport asfimport added this to the 4.0.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants