Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The basic introduction of Redis's new data type HyperLogLog

Shulou Source: shulou.com Published: 2022-06-02 08:55:51 10月03日 Update

This article mainly explains "the basic introduction of Redis new data type HyperLogLog". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the basic introduction of Redis new data type HyperLogLog".

HyperLogLog

HyperLogLog is a data structure of redis, which was added after version 2.8.9.

An algorithm mainly used to do cardinality statistics.

His value does not take up memory space.

Each HyperLogLog key costs only 12 KB of memory to calculate the cardinality of nearly 2 ^ 64 different elements.

What is the cardinality? For example, if his cardinal set is [1pr 2p3], the cardinality is 3. Generally speaking, the cardinality is to count the number of a set of sets.

HyperLogLog-related commands:

Pfadd key element adds the specified element to the HyperLogLog pfcount key returns the cardinality estimate of the given HyperLogLog

Pfmerge newKey key1 key1... Merge multiple HyperLogLog into one. If there is a duplicate cardinality in key1 and key2, it will be merged. For example, key1 adds li,liu,zhang and key adds li,liu. After wu merges, the newKey pfcount is 4.

Thank you for your reading, the above is the content of the "basic introduction of Redis new data type HyperLogLog". After the study of this article, I believe you have a deeper understanding of the basic introduction of Redis new data type HyperLogLog, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Cardinality data basis type that is learning elements memory content data structure structure statistics different number command multiple ideas overall situation article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Apple macOS Redmi