{
  "schema_version": 2,
  "id": "commands/cms.initbyprob",
  "title": "CMS.INITBYPROB",
  "url": "https://redis.io/docs/latest/commands/cms.initbyprob/",
  "summary": "Initializes a Count-Min Sketch to accommodate requested tolerances.",
  "since": "2.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:54+01:00",
  "page_type": "content",
  "content_hash": "c7dd686d774df5cc36ba13c4f8107f5200128749a383d05a378593cc9daead79",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Initializes a Count-Min Sketch to accommodate requested tolerances."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the sketch.\n\n</details>\n\n<details open><summary><code>error</code></summary>\n\nEstimate size of error. The error is a percent of total counted items. This effects the width of the sketch.\n\n</details>\n\n<details open><summary><code>probability</code></summary>\n\nThe desired probability for inflated count. This should be a decimal value between 0 and 1. This effects the depth of the sketch. For example, for a desired false positive rate of 0.1% (1 in 1000), error_rate should be set to 0.001. The closer this number is to zero, the greater the memory consumption per item and the more CPU usage per operation.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Supported</span><br /> | <span title=\"Supported\">&#x2705; Flexible & Annual</span><br /><span title=\"Supported\">&#x2705; Free & Fixed</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nOne of the following:\n\n* [Simple string reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-strings) `OK` if executed correctly.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if the given key already exists.\n\n**RESP3:**\n\nOne of the following:\n\n* [Simple string reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-strings) `OK` if executed correctly.\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) if the given key already exists."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "redis> CMS.INITBYPROB test 0.001 0.01\nOK",
      "section_id": "examples"
    }
  ]
}
