HyperLogLog

Approximate counts of distinct items in about 12 KB a key, with a standard error of 0.81%.

10 commands in KiviDB 1.2.2. Every command.

  • PFADD: Adds elements to the HyperLogLog at key: a structure of fixed size that estimates how many different elements it has been given, however many that is.
  • PFCOUNT: Returns the estimated number of different elements added to the HyperLogLog at key.
  • PFDEBUG: Inspects or converts a HyperLogLog.
    • PFDEBUG DECODE: Returns the runs of a sparse HyperLogLog, as Redis does: Z:n for n zero registers, v:value,count for count registers holding value.
    • PFDEBUG ENCODING: Returns how the HyperLogLog at key is stored: dense, the full 16,384 registers, or sparse, Redis's compact form for one with few elements.
    • PFDEBUG GETREG: Returns all 16,384 registers of the HyperLogLog at key, in order, each a number from 0 to 63.
    • PFDEBUG RESET: Sets every register of the HyperLogLog at key to zero, so that PFCOUNT gives 0 and it counts again from nothing.
    • PFDEBUG TODENSE: Converts a sparse HyperLogLog, one Redis wrote, to the dense encoding.
  • PFMERGE: Merges the HyperLogLogs at the source keys into destkey, so that it estimates their union.
  • PFSELFTEST: Runs KiviDB's checks of its HyperLogLog code and says whether they passed.