Key infrastructure for AI, RAG and semantic search.
Principle¶
Data → embedding model → vector → storage. Query → embedding → nearest neighbor → results.
Algorithms¶
- HNSW — most popular
- IVF — partitioning
- Flat — brute force
Databases¶
- Pinecone — managed
- ChromaDB — OSS embedded
- Weaviate — hybrid search
- Qdrant — Rust, performance
- pgvector — PG extension
Use cases: - RAG - Semantic search - Recommendations - Image similarity
How to Choose the Right Vector Database¶
When choosing, consider several factors: dataset size, latency requirements, operational complexity, and budget. For prototypes and smaller projects (up to 100K vectors), ChromaDB or pgvector is the easiest starting point. For production workloads with millions of vectors, consider Pinecone (managed, zero ops) or Qdrant (self-hosted, high performance).
The HNSW algorithm offers the best speed/accuracy ratio for most use cases. The index is built during data insertion and enables approximate nearest neighbor (ANN) search in sublinear time. The ef_construction and M parameters affect index quality vs. build speed. For hybrid search (combining vector similarity and keyword filtering), Weaviate is the leading choice thanks to native BM25 + vector search support.
Vector DB for AI¶
Essential for RAG and semantic search.