Skip to content

Optimize HashAgg by caching collation sort keys for repeated string keys #10979

Description

@ChangRui-Ryan

Enhancement

For string GROUP BY keys using a non-trivial collation such as
utf8mb4_general_ci, HashAgg currently generates a collation sort key for
every input row.

When the input has many repeated raw string values, the same sort key is
generated repeatedly. For example:

SELECT l_shipmode, COUNT(*)
FROM lineitem
GROUP BY l_shipmode;

If l_shipmode uses utf8mb4_general_ci and has a low NDV, sort-key
generation can consume a significant portion of the aggregation time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions