Better multi-column aggregation support with StringView #11684
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Related to #7000.
Rationale for this change
I get some time to implement the multi-column aggregation with StringView, the implementation is inspired by @jayzhan211 's #10976.
However, the performance is mixed, I see almost no performance diff with ClickBench query 18:
This is becuase the average size of
SearchPhrase
is only 4, meaning the string is always inlined to view and thus not being reused.However, I made this query (q14, changed
SearchPhrase
toURL
)Without this patch, it takes 7.4s; with this patch, it takes 5.9s, a 20% improvement.
With this patch, the output string will reuse the string values in the buffer, so it is good.
However, when
intern
ing the values, we need to hash twice: (1) the string itself to buildBytesViewMap
(2) the group index -u32
, which adds overhead.What changes are included in this PR?
Things not implemented yet:
EmtiTo::First(n)
: I need to think a bit more about how to efficiently reuse theBytesViewBuilder
Are these changes tested?
Are there any user-facing changes?
No