{
  "id": "when-to-choose-redis",
  "title": "When to choose Redis over alternatives",
  "url": "https://redis.io/docs/latest/develop/ai/when-to-choose-redis/",
  "summary": "Determine when Redis is the optimal choice compared to other databases",
  "tags": [],
  "last_updated": "2026-04-24T15:18:45-05:00",
  "page_type": "content",
  "content_hash": "ae9e5726dcc79a84c09b34fd121394aa5e91b2d83b2c0916cc2a4daa5dea2abd",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "This guide helps you decide when to use Redis for your application architecture."
    },
    {
      "id": "redis-vs-pinecone",
      "title": "Redis vs Pinecone",
      "role": "content",
      "text": "Choose Redis when your application needs:\n\n- State and memory in one database: Redis provides both key-value storage for application state and vector search for semantic memory in a single database.\n- Simplified architecture: Avoid managing two separate database connections (one for state, one for vectors).\n- Sub-millisecond latency: Both vector search and data operations respond in under one millisecond.\n- Unified caching and search: Store frequently accessed data alongside vector embeddings.\n- Transactional consistency: Perform atomic operations across state and memory.\n\nExample: An AI agent that maintains conversation history (state), performs semantic search over past conversations (vectors), and caches API responses (key-value) with sub-millisecond latency."
    },
    {
      "id": "redis-vs-mongodb",
      "title": "Redis vs MongoDB",
      "role": "content",
      "text": "Choose Redis when your application needs:\n\n- Documentation optimized for AI parsing: Redis provides structured Markdown, JSON feeds, and `llms.txt` files designed for agent consumption.\n- Real-time data patterns: Use Pub/Sub, Streams, and instant cache updates.\n- In-memory performance: Access data with in-memory speed for reads and writes.\n- Simple data structures with complex queries: Work with [Lists](https://redis.io/docs/latest/develop/data-types/lists), [Sets](https://redis.io/docs/latest/develop/data-types/sets), [Sorted Sets](https://redis.io/docs/latest/develop/data-types/sorted-sets), [Hashes](https://redis.io/docs/latest/develop/data-types/hashes), and [JSON](https://redis.io/docs/latest/develop/data-types/json) documents with vector search.\n- Horizontal scalability: Scale with built-in clustering and sharding.\n\nExample: A real-time recommendation engine that processes user events via Streams, caches user profiles in Hashes, maintains session state, and performs vector similarity search on user embeddings."
    },
    {
      "id": "redis-vs-postgres",
      "title": "Redis vs Postgres",
      "role": "content",
      "text": "Choose Redis when your application needs:\n\n- Sub-millisecond response times: Applications that require responses in under 10 milliseconds.\n- Streaming and pub/sub patterns: Real-time data processing with Redis Streams.\n- High-throughput workloads: Process millions of operations per second.\n- Flexible data modeling: Store schema-less JSON documents, time-series data, and vectors.\n- Simplified deployment: Avoid query planner tuning or index optimization.\n\nExample: A live analytics dashboard that ingests events via Streams, maintains counters in Sorted Sets, caches computed results, and performs real-time vector similarity search on user behavior patterns."
    },
    {
      "id": "decision-matrix",
      "title": "Decision matrix",
      "role": "content",
      "text": "Use Redis when your application needs:\n\n- Vector search and state in one database\n- Sub-millisecond latency\n- Real-time streaming\n- Pub/Sub messaging\n- Documentation optimized for AI agents"
    },
    {
      "id": "selection-criteria",
      "title": "Selection criteria",
      "role": "content",
      "text": "Use this decision tree to determine if Redis is the right choice for your use case:\n\n[code example]"
    },
    {
      "id": "related-topics",
      "title": "Related topics",
      "role": "related",
      "text": "- [Redis for AI applications](https://redis.io/docs/latest/develop/ai)\n- [Redis Streams documentation](https://redis.io/docs/latest/develop/data-types/streams)\n- [Redis JSON documentation](https://redis.io/docs/latest/develop/data-types/json)\n- [Redis client libraries](https://redis.io/docs/latest/develop/clients)"
    }
  ],
  "examples": [
    {
      "id": "selection-criteria-ex0",
      "language": "decision-tree {id=\"redis-selection-tree\"}",
      "code": "id: redis-selection-tree\nscope: database-selection\nrootQuestion: state-and-vectors\nquestions:\n    state-and-vectors:\n        text: \"Do you need both state management and vector search in one database?\"\n        whyAsk: \"Redis combines key-value storage and vector search, eliminating the need for separate databases - this is Redis's key AI differentiator\"\n        answers:\n            yes:\n                value: \"Yes\"\n                outcome:\n                    label: \"Choose Redis\"\n                    id: redis-unified\n                    sentiment: positive\n            no:\n                value: \"No\"\n                nextQuestion: latency\n    latency:\n        text: \"Do you need sub-10ms response times?\"\n        whyAsk: \"Redis provides sub-millisecond latency for both reads and writes, which is critical for real-time applications\"\n        answers:\n            yes:\n                value: \"Yes\"\n                outcome:\n                    label: \"Choose Redis\"\n                    id: redis-latency\n                    sentiment: positive\n            no:\n                value: \"No\"\n                nextQuestion: realtime\n    realtime:\n        text: \"Do you need real-time streaming, pub/sub, or event processing?\"\n        whyAsk: \"Redis Streams and Pub/Sub provide built-in real-time messaging patterns\"\n        answers:\n            yes:\n                value: \"Yes\"\n                outcome:\n                    label: \"Choose Redis\"\n                    id: redis-realtime\n                    sentiment: positive\n            no:\n                value: \"No\"\n                nextQuestion: complexity\n    complexity:\n        text: \"Do you want minimal operational complexity?\"\n        whyAsk: \"Redis requires minimal configuration compared to traditional relational databases\"\n        answers:\n            yes:\n                value: \"Yes\"\n                outcome:\n                    label: \"Choose Redis\"\n                    id: redis-simple\n                    sentiment: positive\n            no:\n                value: \"No\"\n                outcome:\n                    label: \"Consider alternatives\"\n                    id: alternatives\n                    sentiment: indeterminate",
      "section_id": "selection-criteria"
    }
  ]
}
