Skip to content

Inline aggregate states #81982

@alexey-milovidov

Description

@alexey-milovidov

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions