tencent cloud

Tencent Cloud Distributed Cache (Redis OSS-Compatible)

Hyperloglog Group

Download
フォーカスモード
フォントサイズ
最終更新日: 2026-08-11 11:11:59
AI翻訳

Introduction

The HyperLogLog command family uses probabilistic algorithms to estimate the cardinality (count of distinct elements) of extremely large datasets. Each HyperLogLog key occupies a fixed memory footprint of approximately 12 KB, with a standard error of about 0.81%. These commands are suitable for scenarios that do not require exact values, such as UV (Unique Visitor) statistics, search keyword deduplication counting, and large-scale duplicate detection. They can replace Set storage for cardinality estimation at the scale of hundreds of millions, at a very low memory cost. Based on their features, the core commands can be categorized into the following three types:
Add elements
PFADD: Adds one or more elements to a HyperLogLog structure. Internally, it records element characteristics using hash buckets and probabilistic algorithms.
Cardinality Estimation
PFCOUNT: Returns the estimated cardinality for one or more HyperLogLog keys. It also supports directly calculating the union cardinality of multiple keys.
Merge Operations
PFMERGE: Merges multiple HyperLogLog keys into one, stores the union into a destination key, and is suitable for cross-time/cross-dimensional cardinality aggregation scenarios such as multi-day UV accumulation and multi-source deduplication.
For more information, see the Valkey official documentation: HyperLogLog Command Group.

Command Support Overview

Basic Commands: pfadd, pfcount, and pfmerge are fully supported in the standard architecture of Redis versions 2.8, 4.0, 5.0, 6.2, and 7.0, as well as in the standard and cluster architectures of Valkey versions 8.0 and 9.0.
Cross-Slot Restriction: In a cluster architecture, pfcount and pfmerge do not support cross-slot operations. pfadd does not involve cross-slot access scenarios.

Command Compatibility Matrix

The support status of HyperLogLog family commands across different versions and architectures is shown in the table below (✓ indicates supported, ✗ indicates not supported, and — indicates that the command does not involve a cross-slot access scenario).
Command
Valkey 9.0 Standard Architecture
Valkey 9.0 Cluster Architecture
Redis 7.0/Valkey 8.0 Standard Architecture
Redis 7.0/Valkey 8.0 Cluster Architecture
Redis 6.2 Standard Architecture
Redis 6.2 Cluster Architecture
Redis 5.0 Standard Architecture
Redis 5.0 Cluster Architecture
Redis 4.0 Standard Architecture
Redis 4.0 Cluster Architecture
Redis 2.8 Standard Architecture
Cross-Slot Support in Cluster Architecture
pfadd
pfcount
pfmerge

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック