Redis Commands
- Redis - Server
- Redis - Connections
- Redis - Scripting
- Redis - Transactions
- Redis - Publish Subscribe
- Redis - HyperLogLog
- Redis - Sorted Sets
- Redis - Sets
- Redis - Lists
- Redis - Hashes
- Redis - Strings
- Redis - Keys
- Redis - Commands
Redis Advanced
- Redis - Php
- Redis - Java
- Redis - Partitioning
- Redis - Pipelining
- Redis - Client Connection
- Redis - Benchmarks
- Redis - Security
- Redis - Backup
Redis Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Redis - HyperLogLog
Redis HyperLogLog is an algorithm that uses randomization in order to provide an approximation of the number of unique elements in a set using just a constant, and small amount of memory.
HyperLogLog provides a very good approximation of the cardinapty of a set even using a very small amount of memory around 12 kbytes per key with a standard error of 0.81%. There is no pmit to the number of items you can count, unless you approach 264 items.
Example
Following example explains how Redis HyperLogLog works.
redis 127.0.0.1:6379> PFADD tutorials "redis" 1) (integer) 1 redis 127.0.0.1:6379> PFADD tutorials "mongodb" 1) (integer) 1 redis 127.0.0.1:6379> PFADD tutorials "mysql" 1) (integer) 1 redis 127.0.0.1:6379> PFCOUNT tutorials (integer) 3
Redis HyperLogLog Commands
Following table psts some basic commands related to Redis HyperLogLog.
Sr.No | Command & Description |
---|---|
1 | Adds the specified elements to the specified HyperLogLog. |
2 | Returns the approximated cardinapty of the set(s) observed by the HyperLogLog at key(s). |
3 | Merges N different HyperLogLogs into a single one. |