{
  "schema_version": 2,
  "id": "commands/bf.scandump",
  "title": "BF.SCANDUMP",
  "url": "https://redis.io/docs/latest/commands/bf.scandump/",
  "summary": "Begins an incremental save of the bloom filter",
  "since": "1.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": "407f28f57d04d1159245228eaf2ea17683011ea75c15b5dd249cf7456dccf115",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Begins an incremental save of the Bloom filter.\n\nThis command is useful for large Bloom filters that cannot fit into the [`DUMP`](https://redis.io/docs/latest/commands/dump) and [`RESTORE`](https://redis.io/docs/latest/commands/restore) model.\n\nThe first time this command is called, the value of `iter` should be 0. \n\nThis command returns successive `(iter, data)` pairs until `(0, NULL)` to indicate completion."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nis key name for a Bloom filter to save.\n</details>\n\n<details open><summary><code>iterator</code></summary>\n\nIterator value; either 0 or the iterator from a previous invocation of this command\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> BF.RESERVE bf 0.1 10\nOK\nredis> BF.ADD bf item1\n(integer) 1\nredis> BF.SCANDUMP bf 0\n1) (integer) 1\n2) \"\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x05\\x00\\x00\\x00\\x02\\x00\\x00\\x00\\b\\x00\\x00\\x00\\x00\\x00\\x00\\x00@\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x9a\\x99\\x99\\x99\\x99\\x99\\xa9?J\\xf7\\xd4\\x9e\\xde\\xf0\\x18@\\x05\\x00\\x00\\x00\\n\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\nredis> BF.SCANDUMP bf 1\n1) (integer) 9\n2) \"\\x01\\b\\x00\\x80\\x00\\x04 \\x00\"\nredis> BF.SCANDUMP bf 9\n1) (integer) 0\n2) \"\"\nredis> DEL bf\n(integer) 1\nredis> BF.LOADCHUNK bf 1 \"\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x05\\x00\\x00\\x00\\x02\\x00\\x00\\x00\\b\\x00\\x00\\x00\\x00\\x00\\x00\\x00@\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x9a\\x99\\x99\\x99\\x99\\x99\\xa9?J\\xf7\\xd4\\x9e\\xde\\xf0\\x18@\\x05\\x00\\x00\\x00\\n\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\nOK\nredis> BF.LOADCHUNK bf 9 \"\\x01\\b\\x00\\x80\\x00\\x04 \\x00\"\nOK\nredis> BF.EXISTS bf item1\n(integer) 1\n\n\nPython code:\n\nchunks = []\niter = 0\nwhile True:\n    iter, data = BF.SCANDUMP(key, iter)\n    if iter == 0:\n        break\n    else:\n        chunks.append([iter, data])\n\n# Load it back\nfor chunk in chunks:\n    iter, data = chunk\n    BF.LOADCHUNK(key, iter, data)"
    },
    {
      "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* [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays): a two-element array of an [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers) (_Iterator_) and a [Bulk string reply](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) (_Data_).\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: invalid arguments, the key was not found, or the key is of the wrong type.\n\nThe Iterator is passed as input to the next invocation of `BF.SCANDUMP`. If _Iterator_ is 0, then it means iteration has completed.\n\nThe iterator-data pair should also be passed to [`BF.LOADCHUNK`](https://redis.io/docs/latest/commands/bf.loadchunk) when restoring the filter.\n\n**RESP3:**\n\nOne of the following:\n* [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays): a two-element array of an [Integer reply](https://redis.io/docs/latest/develop/reference/protocol-spec#integers) (_Iterator_) and a [Bulk string reply](https://redis.io/docs/latest/develop/reference/protocol-spec#bulk-strings) (_Data_).\n* [Simple error reply](https://redis.io/docs/latest/develop/reference/protocol-spec#simple-errors) in these cases: invalid arguments, the key was not found, or the key is of the wrong type.\n\nThe Iterator is passed as input to the next invocation of `BF.SCANDUMP`. If _Iterator_ is 0, then it means iteration has completed.\n\nThe iterator-data pair should also be passed to [`BF.LOADCHUNK`](https://redis.io/docs/latest/commands/bf.loadchunk) when restoring the filter."
    }
  ],
  "examples": []
}
