> ## Documentation Index
> Fetch the complete documentation index at: https://docs.weventures.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Vector Databases

> Vector databases for AI embeddings and semantic search

<Note>
  Essential for RAG (Retrieval Augmented Generation), semantic search, and AI applications that store and query embeddings.
</Note>

## Production-Ready Vector Databases

<Tabs>
  <Tab title="Pinecone">
    ### Pinecone

    **Fully managed vector database**

    Lightning-fast queries (\<50ms), serverless scaling, enterprise-grade security.

    **Best for:** Production AI apps, enterprise scale, managed infrastructure

    **Key Features:**

    * Sub-50ms query latency
    * Automatic scaling (serverless)
    * SOC 2 Type II compliant
    * Multi-region deployment
    * Pinecone Assistant (all-in-one RAG)
    * Hybrid search support

    **Performance:**

    * Handles billions of vectors
    * Consistent low latency
    * 99.9% uptime SLA

    **Pricing:**

    * Free: 1 index, 5M vectors
    * Serverless: Pay per usage
    * Pod-based: Starting at \$70/month

    **Use Cases:**

    * Production RAG systems
    * Semantic search at scale
    * Recommendation engines
    * Enterprise AI applications

    [Documentation](https://docs.pinecone.io) • [Get Started](https://pinecone.io)
  </Tab>

  <Tab title="Qdrant">
    ### Qdrant

    **High-performance vector search engine**

    Written in Rust for exceptional performance. Memory-efficient with powerful filtering.

    **Best for:** Cost-sensitive workloads, edge deployments, performance-critical apps

    **Key Features:**

    * Written in Rust (blazing fast)
    * Exceptional memory efficiency
    * Advanced filtering capabilities
    * Open-source + managed cloud
    * gRPC and REST APIs
    * Quantization support

    **Performance:**

    * \~60ms query latency
    * Handles billions of vectors
    * Compact memory footprint
    * Edge-compatible

    **Pricing:**

    * Free: Open-source self-hosted
    * Cloud: Free tier available
    * Pay-as-you-go after free tier

    **Use Cases:**

    * Cost-optimized AI apps
    * Edge AI deployments
    * Custom infrastructure
    * High-performance search

    [Documentation](https://qdrant.tech/documentation) • [Get Started](https://qdrant.tech)
  </Tab>

  <Tab title="Weaviate">
    ### Weaviate

    **Cloud-native vector database**

    Hybrid search (vector + keyword), GraphQL API, modular architecture.

    **Best for:** Hybrid search needs, knowledge graphs, flexible deployments

    **Key Features:**

    * Hybrid search (vector + BM25)
    * GraphQL interface
    * Modular architecture
    * Multiple vector spaces per object
    * Built-in vectorization modules
    * HIPAA compliance (2025)

    **Performance:**

    * \~70ms query latency
    * Billions of vectors supported
    * Flexible filtering
    * Real-time indexing

    **Pricing:**

    * Free: Open-source
    * Cloud: Free sandbox
    * Standard: \$25/month
    * Enterprise: Custom

    **Use Cases:**

    * Hybrid search applications
    * Knowledge graph + vectors
    * Multi-tenant systems
    * Regulated industries

    [Documentation](https://weaviate.io/developers/weaviate) • [Get Started](https://weaviate.io)
  </Tab>

  <Tab title="Chroma">
    ### Chroma

    **AI-native embedding database**

    Developer-friendly, lightweight, perfect for prototyping and small/medium apps.

    **Best for:** Prototypes, small-medium apps, quick setup, learning

    **Key Features:**

    * Simple Python/JS API
    * Lightweight & fast setup
    * Built for developers
    * Open-source
    * Easy integration with LangChain
    * In-memory or persistent

    **Performance:**

    * \~100ms query latency
    * Millions of vectors
    * Great for development
    * Not for billion-scale

    **Pricing:**

    * 100% free & open-source
    * Self-hosted only
    * No managed service (yet)

    **Use Cases:**

    * Rapid prototyping
    * Small to medium apps
    * Learning & experimentation
    * Internal tools

    [Documentation](https://docs.trychroma.com) • [Get Started](https://trychroma.com)
  </Tab>
</Tabs>

## PostgreSQL-Based Solutions

<CardGroup cols={2}>
  <Card title="pgvector" icon="database">
    **PostgreSQL extension for vectors**

    Store embeddings directly in Postgres. Use with Supabase, Neon, or any Postgres.

    **Best for:** Existing Postgres users, unified database, cost savings

    **Features:**

    * Native PostgreSQL extension
    * SQL queries for vectors
    * ACID guarantees
    * Works with existing tools
    * RLS support (Supabase)

    **Performance:**

    * \~80ms query latency
    * Millions of vectors
    * L2, inner product, cosine distance
    * HNSW & IVFFlat indexes

    **Pricing:** Free (part of PostgreSQL)

    [Documentation](https://github.com/pgvector/pgvector)
  </Card>

  <Card title="Supabase Vector" icon="bolt">
    **pgvector + Supabase**

    pgvector with Supabase's managed infrastructure, auth, and RLS.

    **Best for:** Supabase users, integrated solution, row-level security

    **Features:**

    * pgvector extension
    * Row-Level Security
    * Supabase Auth integration
    * Edge Functions access
    * Auto-generated APIs

    **Pricing:** Included with Supabase

    [Documentation](https://supabase.com/docs/guides/ai)
  </Card>
</CardGroup>

## Enterprise & Specialized

<CardGroup cols={2}>
  <Card title="Milvus" icon="cloud">
    **Open-source vector database**

    Billion-scale vectors, high performance, cloud-native. Enterprise-grade.

    **Best for:** Billion-scale data, data engineering teams, enterprise AI

    **Features:**

    * Billion+ vector support
    * High throughput
    * GPU acceleration
    * Cloud-native architecture
    * Multiple index types

    **Performance:**

    * \~60ms query latency
    * Handles billions of vectors
    * Horizontal scaling
    * GPU support

    **Pricing:**

    * Free: Open-source
    * Zilliz Cloud: Managed service

    [Documentation](https://milvus.io/docs)
  </Card>

  <Card title="Vespa" icon="server">
    **Big data serving engine**

    Real-time computation over large datasets. Vector search + full-text + structured data.

    **Best for:** Complex queries, real-time ML, large-scale systems

    **Features:**

    * Hybrid search
    * Real-time updates
    * Machine learning inference
    * Combines vectors + text + structured

    **Pricing:** Free & open-source

    [Documentation](https://docs.vespa.ai)
  </Card>
</CardGroup>

## Performance Comparison

| Database     | Latency | Scale     | Memory         | Best For                  |
| ------------ | ------- | --------- | -------------- | ------------------------- |
| **Pinecone** | \<50ms  | Billions  | Efficient      | Production, managed       |
| **Qdrant**   | \~60ms  | Billions  | Very efficient | Cost-sensitive, edge      |
| **Weaviate** | \~70ms  | Billions  | Efficient      | Hybrid search             |
| **Chroma**   | \~100ms | Millions  | Light          | Prototypes, small apps    |
| **pgvector** | \~80ms  | Millions  | Postgres       | Existing Postgres users   |
| **Milvus**   | \~60ms  | Billions+ | High           | Enterprise, billion-scale |

## Feature Comparison

| Feature             | Pinecone | Qdrant      | Weaviate | Chroma   | pgvector      |
| ------------------- | -------- | ----------- | -------- | -------- | ------------- |
| **Managed Service** | ✅ Yes    | ✅ Yes       | ✅ Yes    | ❌ No     | Via providers |
| **Open Source**     | ❌ No     | ✅ Yes       | ✅ Yes    | ✅ Yes    | ✅ Yes         |
| **Self-Host**       | ❌ No     | ✅ Yes       | ✅ Yes    | ✅ Yes    | ✅ Yes         |
| **Hybrid Search**   | ✅ Yes    | ✅ Yes       | ✅ Yes    | ❌ No     | ⚠️ Limited    |
| **Free Tier**       | ✅ Yes    | ✅ Yes       | ✅ Yes    | ✅ Yes    | ✅ Yes         |
| **Filtering**       | ✅ Good   | ✅ Excellent | ✅ Good   | ⚠️ Basic | ✅ SQL         |
| **GraphQL**         | ❌ No     | ❌ No        | ✅ Yes    | ❌ No     | ❌ No          |

## Pricing Comparison

**Free Tiers:**

* **Pinecone**: 1 index, 5M vectors
* **Qdrant**: 1GB cluster free
* **Weaviate**: Sandbox environment
* **Chroma**: Unlimited (self-hosted)
* **pgvector**: Free (with Postgres)

**Paid Plans:**

* **Pinecone**: Serverless (\~$0.10/1M queries) or Pod ($70+/month)
* **Qdrant**: \$20+/month for cloud
* **Weaviate**: \$25+/month standard
* **pgvector**: Postgres hosting costs only

## Integration Examples

<Tabs>
  <Tab title="Pinecone + OpenAI">
    ```python theme={null}
    from pinecone import Pinecone
    from openai import OpenAI

    # Initialize
    pc = Pinecone(api_key="YOUR_KEY")
    openai = OpenAI()
    index = pc.Index("your-index")

    # Create embedding
    embedding = openai.embeddings.create(
        model="text-embedding-3-small",
        input="Your text here"
    ).data[0].embedding

    # Upsert to Pinecone
    index.upsert([("id1", embedding, {"text": "Your text"})])

    # Query
    results = index.query(vector=embedding, top_k=5)
    ```
  </Tab>

  <Tab title="Qdrant + LangChain">
    ```python theme={null}
    from langchain_community.vectorstores import Qdrant
    from langchain_openai import OpenAIEmbeddings
    from qdrant_client import QdrantClient

    # Initialize
    client = QdrantClient(url="http://localhost:6333")
    embeddings = OpenAIEmbeddings()

    # Create vector store
    vectorstore = Qdrant(
        client=client,
        collection_name="my_docs",
        embeddings=embeddings
    )

    # Add documents
    vectorstore.add_texts(["Doc 1", "Doc 2"])

    # Search
    docs = vectorstore.similarity_search("query", k=5)
    ```
  </Tab>

  <Tab title="pgvector + Supabase">
    ```typescript theme={null}
    import { createClient } from '@supabase/supabase-js'
    import OpenAI from 'openai'

    const supabase = createClient(url, key)
    const openai = new OpenAI()

    // Generate embedding
    const embedding = await openai.embeddings.create({
      model: "text-embedding-3-small",
      input: "Your text"
    })

    // Store in Supabase
    await supabase.from('documents').insert({
      content: "Your text",
      embedding: embedding.data[0].embedding
    })

    // Semantic search
    const { data } = await supabase.rpc('match_documents', {
      query_embedding: embedding.data[0].embedding,
      match_threshold: 0.8,
      match_count: 5
    })
    ```
  </Tab>

  <Tab title="Chroma + LangChain">
    ```python theme={null}
    from langchain_community.vectorstores import Chroma
    from langchain_openai import OpenAIEmbeddings

    # Initialize
    embeddings = OpenAIEmbeddings()

    # Create vector store
    vectorstore = Chroma.from_texts(
        texts=["Doc 1", "Doc 2", "Doc 3"],
        embedding=embeddings,
        persist_directory="./chroma_db"
    )

    # Search
    docs = vectorstore.similarity_search("query", k=5)
    ```
  </Tab>
</Tabs>

## Decision Guide

<Steps>
  <Step title="Assess Your Scale">
    **Millions of vectors?** → Chroma, pgvector

    **Hundreds of millions?** → Pinecone, Qdrant, Weaviate

    **Billions of vectors?** → Pinecone, Milvus, Qdrant
  </Step>

  <Step title="Consider Infrastructure">
    **Want fully managed?** → Pinecone

    **Open-source + managed option?** → Qdrant, Weaviate

    **Already using Postgres?** → pgvector

    **Prototyping?** → Chroma
  </Step>

  <Step title="Evaluate Budget">
    **Minimal budget?** → Chroma (free), pgvector (free)

    **Cost-conscious?** → Qdrant (most affordable managed)

    **Production budget?** → Pinecone, Weaviate

    **Enterprise?** → Pinecone, Milvus
  </Step>

  <Step title="Check Requirements">
    **Need hybrid search?** → Weaviate, Qdrant

    **Require SOC 2 compliance?** → Pinecone, Weaviate

    **Want GraphQL?** → Weaviate

    **Need edge deployment?** → Qdrant

    **Existing SQL skills?** → pgvector
  </Step>
</Steps>

## Use Case Recommendations

<Accordion title="RAG Applications">
  **Small-scale (\<1M docs):** Chroma or pgvector

  **Medium-scale (1M-10M docs):** Qdrant or Weaviate

  **Large-scale (10M+ docs):** Pinecone or Milvus

  **Budget-conscious:** pgvector (Supabase) or Qdrant
</Accordion>

<Accordion title="Semantic Search">
  **E-commerce:** Weaviate (hybrid search)

  **Documentation:** Pinecone or Qdrant

  **Internal knowledge base:** Chroma or pgvector

  **Enterprise search:** Weaviate or Milvus
</Accordion>

<Accordion title="Recommendation Systems">
  **User recommendations:** Pinecone or Qdrant

  **Product recommendations:** Weaviate (hybrid)

  **Content recommendations:** Any (based on scale)
</Accordion>

<Accordion title="Chatbots & AI Assistants">
  **Simple chatbot:** Chroma

  **Production chatbot:** Pinecone or Qdrant

  **Enterprise assistant:** Pinecone or Weaviate

  **Edge chatbot:** Qdrant
</Accordion>

## Common Patterns

### RAG Pipeline

1. **Document Chunking** → Split docs into chunks
2. **Generate Embeddings** → OpenAI, Cohere, etc.
3. **Store in Vector DB** → Pinecone, Qdrant, etc.
4. **Query** → Semantic search for relevant chunks
5. **LLM Generation** → Use chunks as context

### Hybrid Search

1. **Vector Search** → Semantic similarity
2. **Keyword Search** → BM25 or full-text
3. **Combine Results** → Reciprocal rank fusion
4. **Return Top K** → Best of both worlds

### Multi-Modal Search

1. **Image Embeddings** → CLIP, etc.
2. **Text Embeddings** → OpenAI, etc.
3. **Store Both** → Same vector space
4. **Cross-Modal Search** → Image → Text or vice versa

## Migration Guide

<Tabs>
  <Tab title="Chroma → Pinecone">
    **When:** Scaling to production

    **Steps:**

    1. Export embeddings from Chroma
    2. Create Pinecone index
    3. Batch upload to Pinecone
    4. Update query code
    5. Test thoroughly
  </Tab>

  <Tab title="pgvector → Qdrant">
    **When:** Need dedicated vector DB

    **Steps:**

    1. Export vectors from Postgres
    2. Setup Qdrant collection
    3. Bulk import vectors
    4. Migrate queries
    5. Update application code
  </Tab>
</Tabs>

## Performance Tips

<Card title="Optimization Strategies">
  **Indexing:**

  * HNSW for speed (most DBs)
  * IVF for memory efficiency
  * Choose based on read/write ratio

  **Filtering:**

  * Pre-filter when possible
  * Use metadata strategically
  * Consider hybrid indexes

  **Batching:**

  * Batch upserts (100-1000 vectors)
  * Parallel queries when possible
  * Use connection pooling

  **Monitoring:**

  * Track query latency
  * Monitor index size
  * Watch memory usage
  * Set up alerts
</Card>
