Back to Redis

TDIGEST.CREATE

content/commands/tdigest.create.md

latest1.8 KB
Original Source

Allocates memory and initializes a new t-digest sketch.

Required arguments

<details open><summary><code>key</code></summary>

is the key name for this new t-digest sketch.

</details>

Optional arguments

<details open><summary><code>COMPRESSION compression</code></summary>

is a controllable tradeoff between accuracy and memory consumption. 100 is a common value for normal uses and also the default if not specified. 1000 is more accurate. For more information on scaling of accuracy versus the compression value see The t-digest: Efficient estimates of distributions.

</details>

Example

{{< highlight bash >}} redis> TDIGEST.CREATE t COMPRESSION 100 OK {{< / highlight >}}

Redis Software and Redis Cloud compatibility

| Redis Software | Redis Cloud | <span style="min-width: 9em; display: table-cell">Notes</span> | |:----------------------|:-----------------|:------| | <span title="Supported">✅ Supported</span> | <span title="Supported">✅ Flexible & Annual</span> <span title="Supported">✅ Free & Fixed</nobr></span> | |

Return information

{{< multitabs id="tdigest-create-return-info" tab1="RESP2" tab2="RESP3" >}}

One of the following:

  • [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) OK if executed correctly.
  • [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect key type or incorrect keyword.

-tab-sep-

One of the following:

  • [Simple string reply]({{< relref "/develop/reference/protocol-spec#simple-strings" >}}) OK if executed correctly.
  • [Simple error reply]({{< relref "/develop/reference/protocol-spec#simple-errors" >}}) in these cases: incorrect key type or incorrect keyword.

{{< /multitabs >}}