Vector Database
A vector database stores embeddings and answers nearest-neighbor queries fast — the retrieval layer under RAG and semantic search, using ANN indexes like HNSW.
A vector database answers one question fast enough for production: which stored vectors are closest to this one? Exact search is hopeless at a hundred million vectors, so these systems use approximate nearest-neighbor indexes, dominated by HNSW, plus metadata filtering, hybrid search, and quantization.
A vector database stores embeddings and answers the query "which stored vectors are closest to this one?" fast enough for production — the retrieval layer beneath RAG and semantic search.
The hard problem it solves is scale. Exact nearest-neighbor search means comparing the query against every vector — fine at ten thousand, hopeless at a hundred million. Vector databases use approximate nearest neighbor (ANN) indexes, dominated by HNSW graphs, to get sub-millisecond lookups at a small, tunable recall cost. Around that core they layer the production necessities: metadata filtering ("only docs from this tenant"), hybrid keyword+vector search, quantization to shrink memory, and replication. Pushing those indexes past memory limits and across shards is its own discipline — see vector search at scale.
The market splits three ways: Postgres-native (pgvector) riding your existing database, open-source engines (Qdrant, Weaviate, Milvus, Chroma, LanceDB), and managed services (Pinecone). The honest decision guide — including when plain pgvector is the right answer — is Best Vector Database in 2026; tuning the index you pick is the embedding-index-tuner skill's job.
Frequently asked questions
- Do I need a dedicated vector database?
- Not always. pgvector adds vector search to the Postgres you already run, and at small-to-medium scale it's often the pragmatic choice. Dedicated engines (Qdrant, Pinecone, Weaviate, Milvus) earn their place with scale, filtering performance, hybrid search, and operational features — the decision tree is in our vector database guide.
- What is HNSW?
- Hierarchical Navigable Small World — the dominant approximate-nearest-neighbor index. It builds a layered graph over vectors so queries hop toward neighbors in logarithmic time instead of scanning everything, trading a little recall for orders-of-magnitude speed. Its parameters (M, efConstruction, efSearch) are the main tuning knobs.
Filed under
vector-database · embeddings · rag · search · hnsw
Related
- Semantic SearchSemantic search retrieves results by meaning rather than keyword overlap — embedding queries and documents in one vector space and matching by similarity.
- EmbeddingAn embedding is a vector of numbers representing text's meaning, placed so similar texts land close together — the foundation of semantic search and RAG.
- RAG (Retrieval-Augmented Generation)RAG retrieves relevant documents from your own data and injects them into an LLM's prompt at query time, grounding answers in facts the model wasn't trained on.
- Best Vector Database in 2026: pgvector vs Pinecone vs Qdrant vs Weaviate vs Milvus vs Chroma vs LanceDBA decision guide to vector databases — embedded, server, or managed; whether you already run Postgres; and which fits your scale, filtering, and RAG needs.
- pgvectorAn open-source Postgres extension that adds a vector type and HNSW/IVFFlat indexes for similarity search inside your existing database.
- QdrantAn open-source vector database written in Rust, built for low-latency similarity search at scale.
- Embedding Index TunerTune a vector index — HNSW graph parameters and quantization — to hit a recall target at the lowest latency and memory, by sweeping settings against a fixed query set instead of trusting defaults. Use when vector search is slow or memory-hungry, when recall dropped after enabling quantization, or when standing up an index and you need defensible parameters.
- How Embeddings Work: Vectors, Similarity, and Choosing a ModelWhat an embedding actually is, how similarity is measured, how the models are trained, and the practical rules for using embeddings well in search and RAG.