HyperLogLog
HyperLogLog was the first probabilistic data structure available in Redis, theorized and published in 2003 by Marianne Durand and Philippe Flajolet. HyperLogLog is an efficient solution to count the number of unique occurrences in a set, which, in practice, is the cardinality of the set. This is especially useful when accuracy is not required: the count is probabilistic but presents a very low error. HyperLogLog does not store any information as the items that are added pass through a hashing function, so it is not possible to remove elements once they are counted.
HyperLogLog is the simplest probabilistic data structure and using it is as easy as adding elements to it using the PFADD command:
PFADD mortensi.com:1hnsn9n6kb:012023 IGaJ9c5KqYHFUEogCQWc PFADD mortensi.com:1hnsn9n6kb:012023 XUq9br38-SYFOVpfN-vq PFADD mortensi.com:1sneb4qq3t:012023 bmGteHMoGpAKbtk4X-9Y PFADD mortensi.com:1sneb4qq3t:022023 IGaJ9c5KqYHFUEogCQWc
Using the former commands, we can track the...