Skip to content

distinct_count()

Estimate the number of distinct values from a hyperloglog

Since 1.3.0

Estimate the number of distinct values from a hyperloglog

Estimate the number of distinct values from a hyperloglog named hyperloglog. The expected output is 98,814.

SELECT distinct_count(hyperloglog(8192, data))
FROM generate_series(1, 100000) data

Output:

distinct_count
----------------
98814

The syntax is:

distinct_count(
hyperloglog Hyperloglog
) RETURNS BIGINT
NameTypeDefaultRequiredDescription
hyperloglogHyperloglog-The hyperloglog to extract the count from.
ColumnTypeDescription
distinct_countBIGINTThe number of distinct elements counted by the hyperloglog.