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 all of the values from 'from' keys to 'destination-key' sketch.

It is mandatory to provide the number of input keys (numkeys) before passing the input keys and the other (optional) arguments.

If destination already exists its values are merged with the input keys. If you wish to override the destination key contents use the OVERRIDE parameter.


  • destination-key: Sketch to copy observation values to (a t-digest data structure)
  • numkeys: Number of sketch(es) to copy observation values from
  • source-key: Sketch(es) to copy observation values from (a t-digest data structure)

Optional parameters:

  • COMPRESSION: The compression parameter. 100 is a common value for normal uses. 1000 is extremely large. If no value is passed, the used compression will the maximal value among all inputs. For more information on scaling of accuracy versus the compression parameter see The t-digest: Efficient estimates of distributions.
  • OVERRIDE: If destination already exists, it is overwritten.


OK on success, error otherwise


redis> TDIGEST.CREATE from-sketch-1
redis> TDIGEST.CREATE from-sketch-2
redis> TDIGEST.ADD from-sketch-1 10.0 1.0
redis> TDIGEST.ADD from-sketch-2 50.0 1.0
redis> TDIGEST.MERGE destination-key 2 from-sketch-1 from-sketch-2


If you've found issues on this page, or have suggestions for improvement, please submit a request to merge or open an issue in the repository.