-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Inline aggregate states #81982
Copy link
Copy link
Closed
Labels
Description
Company or project name
ClickHouse
Describe the situation
Some queries with one simple aggregate function can be optimized.
Currently, aggregation is performed using a hash table (or a similar data structure) with a value of char * pointed to Arena where the aggregate function states are allocated.
If there is just a single aggregate function with the size of state not greater than the size of a pointer and the alignment of state not greater than the alignment of a pointer, and if it is trivially destructible, and they don't use the -State combinator, we can avoid using Arena, and store the state directly in the hash table value instead of a pointer.
This will save one indirection.
Caveats: the aggregate function state should also be movable.
Which ClickHouse versions are affected?
.
How to reproduce
.
Expected performance
No response
Additional context
No response
Reactions are currently unavailable