Vector database
Definition
A database designed to store embeddings and quickly find the nearest neighbours to a query vector, often with metadata filtering.
In more detail
Options range from extensions such as pgvector to dedicated engines such as Qdrant, Weaviate and Milvus and hosted services such as Pinecone. For many projects, adding vectors to a database you already run is the simplest choice.
A vector database stores each embedding with an id and metadata, builds an approximate nearest-neighbour index such as HNSW, and answers queries like "the 10 chunks closest to this question vector, where product = 'billing' and language = 'en'". Most also support keyword search, so you can combine both in hybrid search.
Choose on filtering needs, scale, hosting and operations rather than on headline speed benchmarks. Re-embedding everything when you change embedding models is the cost people forget, so store the source text alongside each vector.
Related terms
Chunking
Splitting documents into pieces sized for embedding and retrieval, ideally along natural boundaries such as sections or paragraphs.
Embedding
A vector representation of text or other data that places items with similar meaning close together, so they can be searched by similarity.
HNSW
Hierarchical Navigable Small World: a graph-based index for fast approximate nearest-neighbour search, widely used by vector databases.
Hybrid search
Combining keyword search, such as BM25, with vector search and merging the results into one ranking, often with reciprocal rank fusion.
Metadata filtering
Narrowing a vector or keyword search with structured fields, such as date, language or access rights, before or during the search.
Cosine similarity
A measure of how similar two vectors are based on the angle between them, ranging from -1 (opposite) to 1 (same direction).
Read more about Vector database
- Embeddings and vector search
Turning text into vectors to find similar items, alone or with keywords.
- pgvector vs Pinecone, Qdrant and Weaviate
When storing embeddings in Postgres with pgvector is enough, and when a dedicated vector database such as Pinecone, Qdrant or Weaviate earns its extra cost.
- Embeddings and vector search, hands on
Embed documents, store them in Postgres with pgvector, index them and run similarity and hybrid search.