← Friday, October 2, 2026DatabasesDeep dive

DuckDB speeds string aggregations by grouping on narrow integer keys

duckdb.org by DuckDB Team 14 min read Editor score 7/10

The technique replaces repeated long strings with sorted integer keys for aggregation, then joins the strings back afterward. It is a practical query-design pattern for reducing work on variable-length values.

What
DuckDB's dimension-table technique speeds aggregations over long, repeated strings by grouping on narrow integer keys.
How
A dimension table maps strings to integers; the query aggregates on those keys and joins the strings back at the end.
Why it matters
This can reduce repeated string hashing, copying and comparison in string-heavy analytical queries.
map assign keys group aggregate look up strin… long, repeatedstrings dimension table small integers hash aggregation join the stringsback
Dimension tables turn repeated strings into integer keys for aggregation, then restore the strings. Sketched from the article's own text.

Discussion

Discussion is not switched on yet. Use Note above to keep your own thoughts on this story.

Headline, summary, brief and diagram are written by a model from the source's own text; the link, byline and numbers come from the source. Read the original before relying on a claim.

Your note

Private to you. Stored in this browser, and synced to your account when you are signed in.