hyperloglog function constructs and returns a hyperloglog with at least
the specified number of buckets over the given values.
For more information about approximate count distinct functions, see the hyperfunctions documentation.
|buckets||integer||Number of buckets in the digest. Rounded up to the next power of 2, must be between 16 and 2^18.|
|value||AnyElement||Column to count distinct elements. The type must have an extended, 64-bit, hash function.|
buckets argument usually provides more accuracy at the expense
of more storage.
|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 hyperloglog(64, weights) FROM samples;
Alternatively, you can build a view from the aggregate that you can pass to
CREATE VIEW digest AS SELECT hyperloglog(64, data) FROM samples;
Found an issue on this page?Report an issue!