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

Improved performance for streaming group by #7023

Closed
alamb opened this issue Jul 19, 2023 · 3 comments
Closed

Improved performance for streaming group by #7023

alamb opened this issue Jul 19, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@alamb
Copy link
Contributor

alamb commented Jul 19, 2023

Is your feature request related to a problem or challenge?

During review of #6932 there were several suggstions made about how we could improve the performance of streaming / bounded grouping (when the data is sorted by some/all of the group keys)

This ticket tracks those improvements

Describe the solution you'd like

Suggestion 1

@tustvold suggests on #6932 (comment)

It occurs to me that a potentially faster way to detect the group boundaries would be to use the inequality kernel offset by one w.r.t to each other, ORing the results together, and then iterating over the set bits.

There would be some subtlety to handle nulls correctly, but it would likely be significantly faster and would not require converting to the row format

We could likely do something similar for window functions if we aren't already

Note that IOx does something similar to compute partition boundaries here: https://github.com/influxdata/influxdb_iox/blob/d3b3805e5fa87214ea934427df3967a57a14669c/iox_query/src/provider/deduplicate/algo.rs#L101-L207

Suggestion 2

From #6932 (comment)

In the case of GroupOrderingFull it seems unnecessary to be computing hashes at all, we can just group based on whenever the sort key changes?

This could likely go quite a bit faster as hashing is a significant part of the time

Describe alternatives you've considered

No response

Additional context

No response

@tustvold
Copy link
Contributor

I implemented suggestion 1 upstream in apache/arrow-rs#4575

@smiklos
Copy link
Contributor

smiklos commented Aug 11, 2024

@alamb I think this issue can be closed. Suggestion 1 is done, suggestion 2 is no longer relevant as there are no hashes computed for GroupOrderingFull

@alamb
Copy link
Contributor Author

alamb commented Aug 11, 2024

Thanks @smiklos -- done!

@alamb alamb closed this as completed Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants