rollup()

rollup(
    log hyperloglog
) RETURNS Hyperloglog

Returns a hyperloglog by aggregating over the union of the input elements.

For more information about approximate count distinct functions, see the hyperfunctions documentation.

Required arguments

NameTypeDescription
logHyperloglogColumn of Hyperloglogs to be united.

Returns

ColumnTypeDescription
hyperloglogHyperloglogA hyperloglog containing the count of the union of the input hyperloglogs.

Sample usage

SELECT distinct_count(rollup(logs))
FROM (
    (SELECT hyperloglog(32, v::text) logs FROM generate_series(1, 100) v)
    UNION ALL
    (SELECT hyperloglog(32, v::text) FROM generate_series(50, 150) v)
) hll;
 count
-------
   152

Found an issue on this page?

Report an issue!

Related Content