当前位置:网站首页>Redis-HyperLogLog-基数统计算法
Redis-HyperLogLog-基数统计算法
2022-06-13 03:51:00 【怪只怪满眼尽是人间烟火】
使用软件:redis
版本:2.8.9
作用:将所有元素参数添加到存储在指定为第一个参数的变量名称处的 HyperLogLog 数据结构中
HLL 具有以下几个特点:
- 能够使用极少的内存来统计巨量的数据,它只需要 12K 空间就能统计 2^64 的数据;
- 统计存在一定的误差,误差率整体较低,标准误差为 0.81%;
- 误差可以被设置辅助计算因子进行降低。
添加元素: 此命令支持添加一个或多个元素至 HLL 结构中。
127.0.0.1:6379> pfadd key "redis"
(integer) 1
127.0.0.1:6379> pfadd key "java" "sql"
(integer) 1
统计不重复的元素:
127.0.0.1:6379> pfadd key "redis"
(integer) 1
127.0.0.1:6379> pfadd key "sql"
(integer) 1
127.0.0.1:6379> pfadd key "redis"
(integer) 0
127.0.0.1:6379> pfcount key
(integer) 2
合并一个或多个 HLL 至新结构:
127.0.0.1:6379> pfadd k "java" "sql"
(integer) 1
127.0.0.1:6379> pfadd k2 "redis" "sql"
(integer) 1
127.0.0.1:6379> pfmerge k3 k k2
OK
127.0.0.1:6379> pfcount k3
(integer) 3
边栏推荐
- 单片机:D/A 输出
- Promise combined with await
- Example of try catch finally execution sequence
- LVS四層負載均衡集群(3)集群功能分類 - HPC
- Stream流的注意事项
- Synching build your own synchronization cloud
- 单片机信号发生器程序
- Big Five personality learning records
- 【测试开发】自动化测试selenium(二)——webdriver常用的API
- Single chip microcomputer: main index of a/d (analog-to-digital conversion)
猜你喜欢
[test development] automated test selenium (III) -- unittest framework analysis
Line height equals height why not center
史上最详细的Swin-Transformer 掩码机制(mask of window attentation)————shaoshuai
【测试开发】用例篇
UnionPay commerce - merchant statistics service platform
Lightweight digital mall system based on PHP
Real time requirements for 5g China Unicom repeater network management protocol
[test development] basic concepts related to testing
SCM: introduction to Modbus communication protocol
【測試開發】自動化測試selenium(三)——unittest框架解析
随机推荐
【测试开发】进阶篇——各种测试技术分类
Lambda end operation find and match findfirst
GoFrame第五天
Synching build your own synchronization cloud
H5 jump to mobile app store
MSG messages in ROS
[test development] automatic test selenium (I)
5g China Unicom ap:b SMS ASCII transcoding requirements
[test development] installation of test management tool Zen path
谈谈激光雷达的波长
ROS话题与节点
USB-IF BC1.2充电协议解读
任总与系统工程领域科学家、专家会谈纪要
[Yugong series] June 2022 Net architecture class 080 master cluster and database switching of distributed middleware schedulemaster
Lambda终结操作collect
单片机:A/D(模数转换)的主要指标
[Yugong series] June 2022 Net architecture class 081 API customization task of distributed middleware schedulemaster
Field * doesn't have a default value problem
SQL injection case demonstration and preventive measures
Flex layout