Skip to content

Vector DB Optimization

Choosing and tuning vector databases for semantic search

How a Vector DB Works

    flowchart LR
    A["Document / text"] --> B["Embedding model<br/>text-embedding-3"]
    B --> C["Vector<br/>[0.12, -0.34, ...]"]
    C --> D["Vector DB<br/>storage"]

    E["User query"] --> F["Embedding model"]
    F --> G["Query vector"]
    G --> H["Similarity search<br/>ANN"]
    D --> H
    H --> I["Relevant documents<br/>Top-K returned"]

    style B fill:#2563EB,stroke:#1D4ED8,color:#fff
    style D fill:#7C3AED,stroke:#6D28D9,color:#fff
    style H fill:#EA580C,stroke:#C2410C,color:#fff
    style I fill:#16A34A,stroke:#15803D,color:#fff
  

Major Vector DB Comparison

DBHostingCharacteristicsBest fit
PineconeManaged cloudFully managed, easy setupRapid prototyping, production
WeaviateSelf-hosted/managedMultimodal, hybrid searchComplex queries, open-source preference
QdrantSelf-hosted/managedRust-based, high performanceLarge scale, performance-critical
ChromaSelf-hostedOptimized for local developmentDev/test environments
pgvectorPostgreSQL extensionIntegrates with an existing DBSmall scale, simple use cases

Key Performance Optimization Metrics

SLA Targets (Production)

  • P95 response time: < 100ms
  • P99 response time: < 200ms
  • Availability: 99.9%+

Optimization Points

1. Embedding Model Selection

text-embedding-3-small: fast, low cost, 1536 dimensions
text-embedding-3-large: higher accuracy, 3072 dimensions

2. Index Configuration

HNSW parameters:
  ef_construction: 128–512 (higher = better accuracy, longer build time)
  M: 16–64 (higher = better accuracy, more memory)

3. Chunking Strategy

Chunk size: 256–512 tokens (adjust based on document type)
Overlap:    50–100 tokens (preserves contextual continuity)