Is it possible to decrement a HyperLogLog set in Redis
Asked Answered
K

1

8

Let's say that i have a hyperloglog in redis which counts messages is there any provisions whereby I can to some degree account for delete messages?

Kunzite answered 15/2, 2017 at 12:59 Comment(4)
Would it be reasonable to create two hyperloglog sets? messages.created and messages.deleted and just assert the decrement?Kunzite
The two hyperloglog sets way MIGHT be a solution. It depends on your scenario. For example, it cannot solve the following scenario: add an element, delete the element, and then add the same element again. Can you give us more details on your scenario?Norward
@Norward Yeah i mean that'd make sense. Although not sure i'd ever create the same element again - as recreating a previously deleted message would have a new UUID.Kunzite
Another solution might be to just recreate the HLL and PFADD the entire dataset. But that becomes less and less feasible with the size of the HLL :(Kunzite
O
12

No, the HyperLogLog doesn't support the concept of deletion. Instead, use a different counter (could be an integer, Set or HyperLogLog) and subtract the totals.

Ody answered 15/2, 2017 at 18:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.