Aggregates Aggregate

approx_count_distinct()

Computes the approximate count of distinct elements using HyperLogLog.

Arguments & returns

approx_count_distinct(any)

Aggregate
Overload link any Returns
#01 ANY BIGINT

Example

approx_count_distinct example
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Engine example with sample data · Run to view results.

In other engines

Apache Hiveapprox_count_distinct()

Same function

Apache Sparkapprox_count_distinct()

Same function

Prestoapprox_distinct()

SELECT APPROX_DISTINCT(a) FROM foo
In Haybarn
SELECT APPROX_COUNT_DISTINCT(a) FROM foo

SQLGlot example ↗