approx_count_distinct function constructs and returns a hyperloglog with a
default size appropriate for the majority of use cases.
For more information about approximate count distinct functions, see the hyperfunctions documentation.
|value||AnyElement||Column to count distinct elements. The type must have an extended, 64-bit, hash function.|
|hyperloglog||hyperloglog||A hyperloglog object which can be passed to other hyperloglog APIs.|
This examples assumes you have a table called
samples, that contains a column
weights that holds DOUBLE PRECISION values. This command returns a
digest over that column:
SELECT toolkit_experimental.approx_count_distinct(weights) FROM samples;
Alternatively, you can build a view from the aggregate that you can pass to
CREATE VIEW hll AS SELECT toolkit_experimental.approx_count_distinct(data) FROM samples;
Found an issue on this page?Report an issue!