v.19.5Improvement

Topk and Topkweighted Now Supports Custom Loadfactor

topK and topKWeighted now supports custom loadFactor (fixes issue #4252). #4634 (Kirill Danshin)
topK and topKWeighted aggregation functions now support a customizable loadFactor.

Why it matters

This feature addresses the limitation where the loadFactor parameter for topK and topKWeighted was fixed, allowing users to tune performance and memory consumption to better fit their workloads and data characteristics.

How to use it

Users can specify the loadFactor parameter when using topK or topKWeighted functions in their queries to customize the behavior, for example:

SELECT topK(10, loadFactor = 10)(column) FROM table;


This enables tailoring the balance between accuracy and resource usage.**