TLDR Data · MISCELLANEOUS

FASTER STRING AGGREGATIONS WITH DIMENSION TABLES

duckdb.org16 min read

Summary from the TLDR Data newsletter

String-heavy aggregations waste time hashing and comparing the same text values repeatedly. DuckDB shows that replacing those columns with small integer surrogate keys through dimension tables can make grouping cheaper, reduce memory pressure, and lower spill risk. The broader takeaway: normalize low-cardinality strings before large analytical aggregations when performance matters.