Vector Database
A specialized database that indexes high-dimensional embedding vectors using ANN algorithms like HNSW or IVF for millisecond semantic similarity search and metadata filtering
Table of Contents
Structure Diagram
What is Vector Database?
A specialized database that indexes high-dimensional embedding vectors using ANN algorithms like HNSW or IVF for millisecond semantic similarity search and metadata filtering. It is a core concept in Retrieval & RAG within AI / ML.
Core Principles
A Vector Database stores high-dimensional dense embeddings extracted from text, images, or audio and retrieves the Top-K closest items to a query vector in milliseconds.
Because exact brute-force scans scale poorly past tens of thousands of vectors, vector databases rely on Approximate Nearest Neighbor (ANN) indexes such as HNSW, IVF, and Product Quantization (PQ) to balance recall, latency, and memory footprint.
Practical Takeaways
- Dedicated engine vs pgvector: For under a few million vectors with tight relational joins and ACID needs,
PostgreSQL + pgvectorminimizes operational overhead. For tens of millions of vectors, multi-tenancy, or strict P99 latency, choose dedicated stores likeQdrant,Milvus,Pinecone, orWeaviate. - Verify Pre-filtering for ACLs: Post-filtering after Top-K retrieval can starve results when filters are selective. Prefer engines supporting filtered ANN traversal.
- Plan for zero-downtime re-indexing: Changing embedding models invalidates the entire vector space; keep raw text and metadata outside the index so you can rebuild and swap collections cleanly.
Notable Examples
- Qdrant / Pinecone / Milvus / Weaviate: Purpose-built vector databases offering hybrid dense+sparse search, scalar/binary quantization, and filtered ANN.
- PostgreSQL + pgvector: Unifies transactional metadata, RBAC joins, and HNSW vector search in one database.
- Visual & Semantic Product Search: Indexes product photos and descriptions to power instant "find similar" recommendations.