VeloDB Cloud
SQL Reference
SQL Functions
Scalar Functions
Hll Functions
HLL_CARDINALITY

HLL_CARDINALITY

Description

HLL_CARDINALITY calculates the cardinality of a HyperLogLog (HLL) type value. It is an approximate counting algorithm suitable for estimating the number of distinct elements in large datasets.

Syntax

HLL_CARDINALITY(<hll>)

Parameters

ParameterDescription
<hll>The HLL type value representing the dataset whose cardinality needs to be estimated.

Return Value

Returns the estimated cardinality of the HLL type value, representing the number of distinct elements in the dataset.

Example

select HLL_CARDINALITY(uv_set) from test_uv;
+---------------------------+
| hll_cardinality(`uv_set`) |
+---------------------------+
|                         3 |
+---------------------------+