{
  "schema_version": 2,
  "id": "operate/oss_and_stack/stack-with-enterprise/search/scalable-query-best-practices",
  "title": "Best practices for scalable Redis Search",
  "url": "https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/scalable-query-best-practices/",
  "summary": "Best practices for scalable Redis Search in Redis Software and Redis Cloud.",
  "tags": [
    "docs",
    "operate",
    "stack"
  ],
  "last_updated": "2026-09-22T10:15:10+01:00",
  "page_type": "content",
  "content_hash": "52e6dd40801c457127e63ff776faa032a40c0591a11e461a3328e55c74f01f56",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "[Vertical scaling of Redis Search](https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/search/query-performance-factor) requires configuring query performance factors. With careful crafting of search indexes and queries, query performance factors allow throughput scaling up to 16X. The following recommendations can help optimize your indexes and queries to maximize the performance benefits from additional CPUs allocated by query performance factors."
    },
    {
      "id": "best-candidates-for-query-performance-factor-improvements",
      "title": "Best candidates for query performance factor improvements",
      "role": "content",
      "text": "- Query types:\n\n    - [Full-text](https://redis.io/docs/latest/develop/ai/search-and-query/query/full-text)\n\n    - [Tag](https://redis.io/docs/latest/develop/ai/search-and-query/advanced-concepts/tags)\n\n    - [Vector](https://redis.io/docs/latest/develop/ai/search-and-query/query/vector-search)\n\n    - [Numeric](https://redis.io/docs/latest/develop/ai/search-and-query/query/range)\n\n    - [Geo](https://redis.io/docs/latest/develop/ai/search-and-query/query/geo-spatial)\n\n- Result set types:\n\n    - Small result sets\n\n    - Document subsets that are indexed in their [non-normalized](https://redis.io/docs/latest/develop/ai/search-and-query/advanced-concepts/sorting#normalization-unf-option) form"
    },
    {
      "id": "best-practices",
      "title": "Best practices",
      "role": "content",
      "text": "If query performance factors have not boosted the performance of your queries as much as expected:\n\n1. Verify your index includes all queried and returned fields.\n\n1. Identify and avoid query [anti-patterns](https://redis.io/docs/latest/develop/ai/search-and-query/best-practices/scalable-query-best-practices#anti-patterns) that limit scalability.\n\n1. Follow best practices to [improve indexing](#improve-indexing).\n\n1. Follow best practices to [improve queries](#improve-queries)."
    },
    {
      "id": "improve-indexing",
      "title": "Improve indexing",
      "role": "content",
      "text": "Follow these best practices for [indexing](https://redis.io/docs/latest/develop/ai/search-and-query/indexing):\n\n- Include fields in the index definition that are used in the query or the required result sets (projections).\n\n- Use `SORTABLE` for all fields returned in result sets.\n\n- Use the `UNF` option for `TAG` and `GEO` fields.\n\n- Use the `NOSTEM` option for `TEXT` fields."
    },
    {
      "id": "improve-queries",
      "title": "Improve queries",
      "role": "content",
      "text": "Follow these best practices to optimize [queries](https://redis.io/docs/latest/develop/ai/search-and-query/query):\n\n- Specify the result set fields in the `RETURN` or `LOAD` clauses and include them in the index definition. Don’t just return the default result set from [`FT.SEARCH`](https://redis.io/docs/latest/commands/ft.search)  or `LOAD *` from [`FT.AGGREGATE`](https://redis.io/docs/latest/commands/ft.aggregate).\n\n- Use `LIMIT` to reduce the result set size.\n\n- Use [`DIALECT 3`](https://redis.io/docs/latest/develop/ai/search-and-query/advanced-concepts/dialects#dialect-3) or higher for any queries against JSON."
    },
    {
      "id": "index-and-query-examples",
      "title": "Index and query examples",
      "role": "content",
      "text": "The following examples depict an anti-pattern index schema and query, followed by a corrected schema and query, which allows for scalability with Redis Search."
    },
    {
      "id": "anti-pattern-index-schema",
      "title": "Anti-pattern index schema",
      "role": "content",
      "text": "The following index schema is not optimized for vertical scaling:\n\n[code example]"
    },
    {
      "id": "anti-pattern-query",
      "title": "Anti-pattern query",
      "role": "content",
      "text": "The following query is not optimized for vertical scaling:\n\n[code example]"
    },
    {
      "id": "improved-index-schema",
      "title": "Improved index schema",
      "role": "content",
      "text": "Here's an improved index schema that follows best practices for vertical scaling:\n\n[code example]"
    },
    {
      "id": "improved-query",
      "title": "Improved query",
      "role": "content",
      "text": "Here's an improved query that follows best practices for vertical scaling:\n\n[code example]"
    },
    {
      "id": "performance-results",
      "title": "Performance results",
      "role": "performance",
      "text": "The following benchmarks show the performance improvements for different query types achieved with query performance factors. Vector, tag, and text queries strongly benefit, while numeric and geographic queries show more limited improvements."
    },
    {
      "id": "vector-schema-type",
      "title": "Vector schema type",
      "role": "content",
      "text": "#### Vector ingest\n\n| Shards | Threads per shard | CPUs | Speedup factor |\n|--------|-------------------|------|----------------|\n| 1      | 0                 | 1    | 0              |\n| 6      | 0                 | 6    | 6.6            |\n| 1      | 6                 | 6    | 2.5            |\n| 2      | 6                 | 12   | 6.1            |\n| 4      | 6                 | 24   | 24.3           |\n\n#### Vector query\n\n| Shards | Threads per shard | CPUs | Speedup factor |\n|--------|-------------------|------|----------------|\n| 1      | 0                 | 1    | 0              |\n| 6      | 0                 | 6    | 0.8            |\n| 1      | 6                 | 6    | 4.7            |\n| 2      | 6                 | 12   | 5.1            |\n| 4      | 6                 | 24   | 5.6            |"
    },
    {
      "id": "tag-schema-type",
      "title": "Tag schema type",
      "role": "content",
      "text": "| Worker threads | % change |\n|----------------|----------|\n| 0              | 0        |\n| 6              | 135.88   |"
    },
    {
      "id": "text-schema-type",
      "title": "Text schema type",
      "role": "content",
      "text": "#### Two-word union queries\n\n| Worker threads | Queries per second | % change |\n|----------------|--------------------|----------|\n| 0              | 188                | 0        |\n| 6              | 1,072              | 470      |\n| 12             | 1,995              | 961      |\n| 18             | 2,834              | 1,407    |\n\n#### Two-word intersection queries\n\n| Worker threads | Queries per second | % change |\n|----------------|--------------------|----------|\n| 0              | 2,373              | 0        |\n| 6              | 12,396             | 422      |\n| 12             | 17,506             | 638      |\n| 18             | 19,764             | 733      |\n\n#### Simple one-word match\n\n| Worker threads | Queries per second | % change |\n|----------------|--------------------|----------|\n| 0              | 476                | 0        |\n| 6              | 2,837              | 496      |\n| 12             | 5,292              | 1,012    |\n| 18             | 7,512              | 1,478    |"
    },
    {
      "id": "numeric-schema-type",
      "title": "Numeric schema type",
      "role": "content",
      "text": "| Worker threads | Queries per second | % change |\n|----------------|--------------------|----------|\n| 0              | 33,584             | 0        |\n| 1              | 36,993             | 10.15    |\n| 3              | 36,504             | 8.69     |\n| 6              | 36,897             | 9.86     |"
    },
    {
      "id": "geo-schema-type",
      "title": "Geo schema type",
      "role": "content",
      "text": "#### Geo queries without UNF\n\n| Worker threads | Queries per second | % change |\n|----------------|--------------------|----------|\n| 0              | 48                 | 0        |\n| 6              | 96                 | 100      |\n| 12             | 96                 | 100      |\n| 18             | 98                 | 104      |\n\n#### Geo queries with UNF\n\n| Worker threads | Queries per second | % change |\n|----------------|--------------------|----------|\n| 0              | 61                 | 0        |\n| 6              | 227                | 272      |\n| 12             | 217                | 256      |\n| 18             | 217                | 256      |"
    }
  ],
  "examples": [
    {
      "id": "anti-pattern-index-schema-ex0",
      "language": "sh",
      "code": "FT.CREATE jsonidx:profiles ON JSON PREFIX 1 profiles: \n          SCHEMA $.tags.* as t NUMERIC SORTABLE \n                 $.firstName as name TEXT \n                 $.location as loc GEO",
      "section_id": "anti-pattern-index-schema"
    },
    {
      "id": "anti-pattern-query-ex0",
      "language": "sh",
      "code": "FT.AGGREGATE jsonidx:profiles '@t:[1299 1299]' LOAD * LIMIT 0 10",
      "section_id": "anti-pattern-query"
    },
    {
      "id": "improved-index-schema-ex0",
      "language": "sh",
      "code": "FT.CREATE jsonidx:profiles ON JSON PREFIX 1 profiles: \n          SCHEMA $.tags.* as t NUMERIC SORTABLE \n                 $.firstName as name TEXT NOSTEM SORTABLE \n                 $.lastName as lastname TEXT NOSTEM SORTABLE \n                 $.location as loc GEO SORTABLE \n                 $.id as id TAG SORTABLE UNF \n                 $.ver as ver TAG SORTABLE UNF",
      "section_id": "improved-index-schema"
    },
    {
      "id": "improved-query-ex0",
      "language": "sh",
      "code": "FT.AGGREGATE jsonidx:profiles '@t:[1299 1299]' \n                LOAD 6 id t name lastname loc ver\n                LIMIT 0 10\n                DIALECT 3",
      "section_id": "improved-query"
    }
  ]
}
