What is a vector database?
A vector database stores embeddings and retrieves the ones nearest to a query vector. Where a traditional database matches exact values, a vector database matches by similarity, returning the closest neighbors under a distance metric such as cosine similarity. To stay fast at scale it relies on approximate nearest neighbor indexes rather than comparing against every stored vector.
Examples include purpose-built systems like Qdrant, Pinecone, Milvus, and LanceDB, as well as vector extensions to general-purpose databases.
Key takeaways
- A vector database indexes embeddings for similarity search.
- It answers nearest-neighbor queries in milliseconds at scale.
- It relies on approximate nearest neighbor indexing for speed.
How it works
Embeddings are inserted along with metadata, and the database builds an ANN index over them, using structures like graph-based HNSW or quantization-based indexes. A query embedding is matched against the index to return the top-k most similar items, optionally filtered by metadata. The trade-off between recall and latency is tunable through index parameters.
Why it matters
Once a dataset outgrows brute-force comparison, a vector index is what keeps similarity search interactive. For visual AI teams, vector databases underpin natural-language search over images, find-similar workflows, and retrieval-augmented pipelines across datasets far too large to scan.
Frequently asked questions
When do I need a vector database instead of brute force?
Roughly when your collection grows past a few hundred thousand vectors or you need low-latency queries under load. Below that, exact search is often fine.
What distance metrics do vector databases use?
Most commonly cosine similarity, dot product, or Euclidean distance, chosen to match how the embedding model was trained.
Related terms
Go deeper