Why is HyperLogLog it's own data structure?

What is the technical explanation that HLLs are a different data structure, but are in turn encoded with a Redis string?

Just like each of the 10 Redis Data Structures, HLL has unique functionality, so even tho it may accept or return a string, it behaves differently inside and serves a different purpose. To learn how to use Redis HyperLogLog, checkout this 5 min. video from Redis University - Redis HyperLogLog Explained

1 Like

I don’t know the initial motivation behind HLL being a string, but it does mean it has some very interesting properties that wouldn’t be directly available if it wasn’t.

For example, it’s possible GET and SET it, so you can store it in another medium. For example, you can use PFADD to create the HLL as normal, then GET the value of that key, store it in a file on the client and later use SET recreate the HLL and run PFCOUNT on it.

1 Like