postgresql-hll

PostgreSQL extension for HyperLogLog cardinality estimation

brewmacoslinux
Try with needOr install directly
Source

About

PostgreSQL extension adding HyperLogLog data structures as a native data type

Commands

psql

Examples

Install the HyperLogLog extension in PostgreSQL database$ psql -d mydb -c 'CREATE EXTENSION hll;'
Create a table with HLL column for counting unique users$ psql -d mydb -c 'CREATE TABLE events (id SERIAL, hll_sketch hll);'
Insert data into HLL column and get cardinality estimate$ psql -d mydb -c "INSERT INTO events (hll_sketch) VALUES (hll_add_agg(hll_hash_integer(user_id))) FROM users; SELECT hll_cardinality(hll_sketch) FROM events;"