TDIGEST.MERGE

Syntax
TDIGEST.MERGE destination-key numkeys source-key [source-key ...]
  [COMPRESSION compression] [OVERRIDE]
Available in:
Redis Stack / Bloom 2.4.0
Time complexity:
O(N*K), where N is the number of centroids and K being the number of input sketches

Merges multiple t-digest sketches into a single sketch.

Required arguments

destination-key

is key name for a t-digest sketch to merge observation values to.

If destination-key does not exist - a new sketch is created.

If destination-key is an existing sketch, its values are merged with the values of the source keys. To override the destination key contents use OVERRIDE.

numkeys Number of sketches to merge observation values from (1 or more).
source-key each is a key name for a t-digest sketch to merge observation values from.

Optional arguments

COMPRESSION compression

is a controllable tradeoff between accuracy and memory consumption. 100 is a common value for normal uses. 1000 is more accurate. If no value is passed by default the compression will be 100. For more information on scaling of accuracy versus the compression parameter see The t-digest: Efficient estimates of distributions.

When COMPRESSION is not specified:

  • If destination-key does not exist or if OVERRIDE is specified, the compression is set to the maximal value among all source sketches.
  • If destination-key already exists and OVERRIDE is not specified, its compression is not changed.
OVERRIDE When specified, if `destination-key` already exists, it is overwritten.

Return value

OK on success, error otherwise.

Examples

redis> TDIGEST.CREATE s1
OK
redis> TDIGEST.CREATE s2
OK
redis> TDIGEST.ADD s1 10.0 20.0
OK
redis> TDIGEST.ADD s2 30.0 40.0
OK
redis> TDIGEST.MERGE sM 2 s1 s2
OK
redis> TDIGEST.BYRANK sM 0 1 2 3 4
1) "10"
2) "20"
3) "30"
4) "40"
5) "inf"

Rate this page