HLL_UNION_AGG

description

Syntax

HLL_UNION_AGG(hll)

HLL is an engineering implementation based on HyperLogLog algorithm, which is used to save the intermediate results of HyperLogGog calculation process.

It can only be used as the value column type of the table and reduce the amount of data through aggregation to achieve the purpose of speeding up the query.

An estimated result with an error of about 1% based on hll. The hll column is generated by other columns or data imported into the data.

When importing, hll_hash function is used to specify which column in data is used to generate hll column. It is often used to replace count distinct, and to calculate uv quickly in business by combining rollup.

example

MySQL > select HLL_UNION_AGG(uv_set)
from test_uv;;
+-------------------------+
| HLL_UNION_AGG(`uv_set`) |
+-------------------------+
| 17721                   |
+-------------------------+

keyword

HLL_UNION_AGG,HLL,UNION,AGG