Skip to main content

uniqHLL12

Introduced in: v1.1.0 Calculates the approximate number of different argument values, using the HyperLogLog algorithm.
We do not recommend using this function. In most cases, use the uniq or uniqCombined function.
This function calculates a hash for all parameters in the aggregate, then uses it in calculations. It uses the HyperLogLog algorithm to approximate the number of different argument values.2^12 5-bit cells are used. The size of the state is slightly more than 2.5 KB. The result is not very accurate (up to ~10% error) for small data sets (<10K elements). However, the result is fairly accurate for high-cardinality data sets (10K-100M), with a maximum error of ~1.6%. Starting from 100M, the estimation error increases, and the function will return very inaccurate results for data sets with extremely high cardinality (1B+ elements).Provides a determinate result (it does not depend on the query processing order).
Syntax
Arguments Returned value Returns a UInt64-type number representing the approximate number of different argument values. UInt64 Examples Basic usage
Query
Response
See Also
Last modified on July 2, 2026