首页  

Redis HyperLogLog 使用     所属分类 redis 浏览量 1226
基数 不重复元素个数
cardinal number
Cardinality query

HyperLogLog 用来做基数统计 不存储原始数据  有一定的误差
2.8.9 版本添加了 HyperLogLog 结构

每个 HyperLogLog  只需要  12 KB 内存,就可以计算接近 2^64 个不同元素的基数



pfadd key element	添加指定元素到 HyperLogLog 中	如果已经存储元索,则返回为 0 
pfcount key	返回基数值	 
pfmerge destKey key1 key2 ... 	合并多个 HyperLogLog,并保存在 destKey 中

Probabilistic data Structures – Bloom filter and HyperLogLog for Big Data
http://eugenedvorkin.com/probabilistic-data-structures-bloom-filter-and-hyperloglog-for-big-data/

with a single HyperLogLog structure using 2.56 KB you can count the number of unique items up to approximately 7,900,000,000 items with 1.625% error.

上一篇     下一篇
redis基本操作

redis复杂嵌套数据结构处理

aerospike VS redis

git回退到之前的版本

git合并处理

数据结构要点