{
  "id": "cms.merge",
  "title": "CMS.MERGE",
  "url": "https://redis.io/docs/latest/commands/cms.merge/",
  "summary": "Merges several sketches into one sketch",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-09T10:29:34-04:00",
  "page_type": "content",
  "content_hash": "ce687bca19c67e4def03bbcabf9dbf8f35d07b8f9a4ba77554d48f24d1b4ac24",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "This command's behavior varies in clustered Redis environments. See the [multi-key operations]() page for more information.\n\n\n\nMerges several sketches into one sketch. All sketches must have identical width and depth. Weights can be used to multiply certain sketches. Default weight is 1."
    },
    {
      "id": "parameters",
      "title": "Parameters:",
      "role": "parameters",
      "text": "* **dest**: The name of destination sketch. Must be initialized. \n* **numKeys**: Number of sketches to be merged.\n* **src**: Names of source sketches to be merged.\n* **weight**: Multiple of each sketch. Default =1."
    },
    {
      "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]() `OK` if executed correctly.\n* [Simple error reply]() in these cases: non-existent key or destination key is not of the same width and/or depth.\n\n**RESP3:**\n\nOne of the following:\n\n* [Simple string reply]() `OK` if executed correctly.\n* [Simple error reply]() in these cases: non-existent key or destination key is not of the same width and/or depth."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "redis> CMS.MERGE dest 2 test1 test2 WEIGHTS 1 3\nOK",
      "section_id": "examples"
    }
  ]
}
