{
  "schema_version": 2,
  "id": "commands/vrange",
  "title": "VRANGE",
  "url": "https://redis.io/docs/latest/commands/vrange/",
  "summary": "Return elements in a lexicographical range",
  "since": "8.4.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:47:58+01:00",
  "page_type": "content",
  "content_hash": "adfb6f39909f82040e2ae632f569124703041fd5b32092ac34c54339f3f429d8",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "The `VRANGE` command provides a stateless iterator for the elements inside a vector set. It allows you to retrieve all the elements inside a vector set in small amounts for each call, without an explicit cursor, and with guarantees about what you will miss in case the vector set is changing (elements added and/or removed) during the iteration.\n\nThe command returns elements in lexicographical order, using byte-by-byte comparison (like `memcmp()`) to establish a total order among elements."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>key</code></summary>\n\nThe name of the vector set key from which to retrieve elements.\n\n</details>\n\n<details open><summary><code>start</code></summary>\n\nThe starting point of the lexicographical range. Can be:\n- A string prefixed with `[` for inclusive range (e.g., `[Redis`)\n- A string prefixed with `(` for exclusive range (e.g., `(a7`)\n- The special symbol `-` to indicate the minimum element\n\n</details>\n\n<details open><summary><code>end</code></summary>\n\nThe ending point of the lexicographical range. Can be:\n- A string prefixed with `[` for inclusive range\n- A string prefixed with `(` for exclusive range\n- The special symbol `+` to indicate the maximum element\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>count</code></summary>\n\nThe maximum number of elements to return. If `count` is negative, the command returns all elements in the specified range (which may block the server for a long time with large sets).\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "Retrieve the first 10 elements starting from the string \"Redis\" (inclusive):\n\n[code example]\n\nIterate through all elements, 10 at a time:\n\n[code example]\n\nContinue iteration from the last element of the previous result (exclusive):\n\n[code example]\n\nReturn all elements in the set (use with caution):\n\n[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; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nOne of the following:\n\n- [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) of elements in lexicographical order within the specified range.\n- [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) (empty array) if the key doesn't exist.\n\n**RESP3:**\n\nOne of the following:\n\n- [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) of elements in lexicographical order within the specified range.\n- [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) (empty array) if the key doesn't exist."
    },
    {
      "id": "behavior",
      "title": "Behavior",
      "role": "content",
      "text": "- **Iteration guarantees**: Each range will produce exactly the elements that were present in the range at the moment the `VRANGE` command was executed.\n- **Concurrent modifications**: Elements removed or added during iteration may or may not be returned, depending on when they were modified.\n- **Empty key**: If the key doesn't exist, returns an empty array."
    },
    {
      "id": "related-topics",
      "title": "Related topics",
      "role": "related",
      "text": "- [Vector sets](https://redis.io/docs/latest/develop/data-types/vector-sets)"
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "VRANGE word_embeddings [Redis + 10",
      "section_id": "examples"
    },
    {
      "id": "examples-ex1",
      "language": "plaintext",
      "code": "VRANGE mykey - + 10",
      "section_id": "examples"
    },
    {
      "id": "examples-ex2",
      "language": "plaintext",
      "code": "VRANGE mykey (a7 + 10",
      "section_id": "examples"
    },
    {
      "id": "examples-ex3",
      "language": "plaintext",
      "code": "VRANGE mykey - + -1",
      "section_id": "examples"
    }
  ]
}
