Vector databases are specialized storage systems optimized for storing, indexing, and searching high-dimensional embedding vectors — enabling fast similarity search across millions to billions of vectors, essential infrastructure for RAG systems, semantic search, recommendation engines, and any application requiring finding "similar" items in embedding space.
What Are Vector Databases?
- Definition: Databases designed to store and query vector embeddings.
- Core Operation: Find K nearest neighbors to a query vector.
- Scale: Handle millions to billions of vectors efficiently.
- Beyond Search: Support filtering, metadata, hybrid search.
Why Vector Databases Matter
- RAG Foundation: Enable retrieval-augmented generation for LLMs.
- Semantic Search: Find meaning, not just keywords.
- Scale: Brute-force O(n) search doesn't scale; need efficient indexes.
- Production Features: CRUD, filtering, replication, backups.
- Speed: Sub-100ms queries across millions of vectors.
- Accuracy: Trade-off with speed, configurable.
Core Concepts
Embedding Vectors:
- Dense numerical representations of data (text, images, etc.).
- Typical dimensions: 384, 768, 1024, 1536, 3072.
- Similar items = similar vectors (close in space).
Distance Metrics:
Metric | Formula | Use Case
--------------------|----------------------------|------------------
Cosine Similarity | 1 - (A·B)/(|A||B|) | Text embeddings
Euclidean (L2) | sqrt(Σ(ai-bi)²) | Image features
Dot Product (IP) | A·B | Normalized vectors
Index Types:
- Flat/Brute-force: Exact, O(n), for small datasets.
- IVF (Inverted File): Cluster-based approximate search.
- HNSW: Graph-based, high recall, more memory.
- PQ (Product Quantization): Compressed vectors, low memory.
Major Vector Databases
Dedicated Vector DBs:
Database | Highlights | Best For
-----------|-----------------------------------|------------------
FAISS | Meta, library, CPU/GPU | Research, embedded
Milvus | Distributed, scalable, open source| Large-scale prod
Qdrant | Rust, filtering, rich features | Production RAG
Pinecone | Managed, serverless, easy | Quick start, scale
Weaviate | Hybrid search, GraphQL | Complex queries
ChromaDB | Simple, embedded, dev-friendly | Prototyping, local
Database Extensions:
- pgvector: PostgreSQL extension for vectors.
- Elasticsearch: Dense vector support added.
- Redis: Vector similarity search module.
Performance Comparison
Database | Vectors | QPS (K=10) | Recall@10
------------|-----------|------------|----------
Milvus | 1B | 2,000+ | 95%+
Qdrant | 100M | 5,000+ | 98%+
Pinecone | 1B | ~1,000 | 95%+
pgvector | 10M | ~500 | 99%+
ChromaDB | 1M | ~1,000 | 99%+
Varies significantly by hardware, index config, vector dimension
RAG Architecture with Vector DB
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 470" width="100%" height="100%" style="background:#0F172A;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
<defs>
<linearGradient id="cardGrad" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" stop-color="#1E293B"/>
<stop offset="100%" stop-color="#0F172A"/>
</linearGradient>
</defs>
<!-- Title Banner -->
<rect x="20" y="20" width="720" height="56" rx="14" fill="url(#cardGrad)" stroke="#334155" stroke-width="1"/>
<text x="36" y="46" font-size="18" font-weight="800" fill="#F8FAFC">Vector Database Architecture & Similarity Search</text>
<text x="36" y="64" font-size="12" font-weight="600" fill="#94A3B8">High-Dimensional Indexing · HNSW Graph Topology · IVF-PQ Quantization · Sub-millisecond ANN Retrieval</text>
<!-- Panel 1: Vector Indexing & Ingestion -->
<rect x="20" y="90" width="350" height="350" rx="16" fill="url(#cardGrad)" stroke="#334155" stroke-width="1"/>
<text x="40" y="118" font-size="14" font-weight="700" fill="#38BDF8">1. Vector Indexing Pipeline</text>
<rect x="40" y="140" width="310" height="45" rx="8" fill="#0F172A" stroke="#475569" stroke-width="1"/>
<text x="55" y="160" font-size="11" font-weight="700" fill="#CBD5E1">Raw Unstructured Data:</text>
<text x="55" y="175" font-size="11" font-weight="800" fill="#38BDF8">Text Documents, Audio, Images, Video</text>
<path d="M 195,185 L 195,205" stroke="#94A3B8" stroke-width="2"/>
<rect x="40" y="205" width="310" height="45" rx="8" fill="#1E293B" stroke="#0284C7" stroke-width="1.5"/>
<text x="55" y="225" font-size="11" font-weight="700" fill="#CBD5E1">Embedding Model (Dense Encoding):</text>
<text x="55" y="240" font-size="11" font-weight="800" fill="#A78BFA">Outputs 768 / 1536-dim Float32 Vectors</text>
<path d="M 195,250 L 195,270" stroke="#94A3B8" stroke-width="2"/>
<rect x="40" y="270" width="310" height="150" rx="10" fill="#0F172A" stroke="#334155" stroke-width="1"/>
<text x="55" y="292" font-size="12" font-weight="800" fill="#F8FAFC">Indexing Algorithms (ANN):</text>
<text x="55" y="315" font-size="11" font-weight="700" fill="#38BDF8">• HNSW (Hierarchical Navigable Small World):</text>
<text x="70" y="332" font-size="10" font-weight="600" fill="#CBD5E1">Multi-layer graph with logarithmic O(log N) search.</text>
<text x="55" y="355" font-size="11" font-weight="700" fill="#F59E0B">• IVF-PQ (Inverted File + Product Quantization):</text>
<text x="70" y="372" font-size="10" font-weight="600" fill="#CBD5E1">Cluster centroids + compressed vector payloads.</text>
<text x="55" y="395" font-size="11" font-weight="700" fill="#A78BFA">• Hybrid Search:</text>
<text x="70" y="410" font-size="10" font-weight="600" fill="#CBD5E1">BM25 Sparse Keyword + Dense Vector Fusion (RRF).</text>
<!-- Panel 2: HNSW Multi-Layer Graph Search -->
<rect x="390" y="90" width="350" height="350" rx="16" fill="url(#cardGrad)" stroke="#334155" stroke-width="1"/>
<text x="410" y="118" font-size="14" font-weight="700" fill="#38BDF8">2. HNSW Graph Similarity Search</text>
<rect x="410" y="135" width="310" height="180" rx="10" fill="#0F172A" stroke="#334155" stroke-width="1"/>
<!-- Layer 2: Sparse Top Layer -->
<line x1="430" y1="165" x2="700" y2="165" stroke="#334155" stroke-width="1" stroke-dasharray="2,2"/>
<text x="440" y="158" font-size="10" font-weight="800" fill="#F59E0B">Layer 2 (Coarse Entry):</text>
<circle cx="500" cy="165" r="5" fill="#F59E0B"/>
<circle cx="640" cy="165" r="5" fill="#475569"/>
<line x1="500" y1="165" x2="640" y2="165" stroke="#F59E0B" stroke-width="1.5"/>
<!-- Layer 1: Medium Layer -->
<line x1="430" y1="220" x2="700" y2="220" stroke="#334155" stroke-width="1" stroke-dasharray="2,2"/>
<text x="440" y="213" font-size="10" font-weight="800" fill="#A78BFA">Layer 1 (Medium Granularity):</text>
<circle cx="500" cy="220" r="5" fill="#A78BFA"/>
<circle cx="570" cy="220" r="5" fill="#A78BFA"/>
<circle cx="640" cy="220" r="5" fill="#475569"/>
<line x1="500" y1="220" x2="570" y2="220" stroke="#A78BFA" stroke-width="1.5"/>
<line x1="570" y1="220" x2="640" y2="220" stroke="#475569" stroke-width="1.5"/>
<!-- Layer 0: Dense Bottom Layer -->
<line x1="430" y1="275" x2="700" y2="275" stroke="#334155" stroke-width="1" stroke-dasharray="2,2"/>
<text x="440" y="268" font-size="10" font-weight="800" fill="#38BDF8">Layer 0 (Dense Fine Search):</text>
<circle cx="500" cy="275" r="5" fill="#475569"/>
<circle cx="540" cy="275" r="5" fill="#38BDF8"/>
<circle cx="570" cy="275" r="5" fill="#38BDF8"/>
<circle cx="610" cy="275" r="5" fill="#38BDF8"/>
<circle cx="640" cy="275" r="5" fill="#475569"/>
<line x1="540" y1="275" x2="570" y2="275" stroke="#38BDF8" stroke-width="1.5"/>
<line x1="570" y1="275" x2="610" y2="275" stroke="#38BDF8" stroke-width="1.5"/>
<!-- Vertical descent path lines -->
<line x1="500" y1="165" x2="500" y2="220" stroke="#F59E0B" stroke-width="1.5" stroke-dasharray="3,3"/>
<line x1="570" y1="220" x2="570" y2="275" stroke="#A78BFA" stroke-width="1.5" stroke-dasharray="3,3"/>
<!-- Key Metrics Box -->
<rect x="410" y="325" width="310" height="100" rx="10" fill="#1E293B" stroke="#475569" stroke-width="1"/>
<text x="425" y="348" font-size="12" font-weight="800" fill="#38BDF8">Vector DB Benchmarks & Engines:</text>
<text x="425" y="370" font-size="11" font-weight="600" fill="#F8FAFC">Engines: Milvus, Qdrant, Pinecone, FAISS, Pgvector</text>
<text x="425" y="392" font-size="11" font-weight="600" fill="#CBD5E1">Recall vs Latency: 98%+ Recall @ <2ms Latency</text>
<text x="425" y="412" font-size="10" font-weight="700" fill="#F59E0B">Filtering: Pre-filtering vs Single-Stage Payload Filtering</text>
</svg>
Key Features to Consider
- Hybrid Search: Combine vector + keyword (BM25) search.
- Filtering: Query vectors with metadata constraints.
- Multi-Tenancy: Isolate data between customers.
- Replication: High availability and disaster recovery.
- Updates: Efficient insert/update/delete operations.
- Cost: Managed vs. self-hosted economics.
Selection Criteria
- Scale: How many vectors? (Millions → Milvus/Pinecone).
- Simplicity: Quick start? (ChromaDB, Pinecone).
- Self-Hosted: Control needed? (Milvus, Qdrant, FAISS).
- Features: Hybrid search? Filtering? (Weaviate, Qdrant).
- Existing Stack: Use Postgres? (pgvector).
Vector databases are the infrastructure foundation for semantic AI applications — as more applications need to find "similar" rather than "exact" matches, vector databases provide the scalable, fast retrieval that makes RAG, recommendation systems, and semantic search practical at production scale.
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.