What Is a Vector Database? Storing and Searching Embeddings Explained
A vector database is a store built to index and search high-dimensional embedding vectors by similarity, powering semantic search and retrieval-augmented generation.
Modern AI represents text, images, and other data as embeddings - long lists of numbers that capture meaning. To find similar items, you search these vectors by closeness, not by exact match. A vector database is purpose-built for exactly that: fast similarity search over millions of embeddings.
What a vector database is
A vector database stores embedding vectors and lets you query for the nearest ones to a given vector. Instead of matching keywords, it finds items whose meaning is closest. Examples include Pinecone, Weaviate, Qdrant, Milvus, and pgvector for PostgreSQL.
How similarity search works
Comparing a query against every stored vector is too slow at scale, so vector databases use approximate nearest neighbor (ANN) indexes like HNSW. These trade a tiny amount of accuracy for enormous speed, returning the closest vectors in milliseconds across millions of entries.
What they power
Vector databases underpin semantic search, recommendation, deduplication, and retrieval-augmented generation (RAG), where an LLM retrieves relevant documents by embedding similarity before answering. They are a core piece of modern AI application stacks.
Vector databases in CI
Code that embeds data and queries the database is tested in CI against a local or ephemeral vector store seeded with sample vectors.
steps:
- run: docker compose up -d qdrant # ephemeral vector DB
- run: pytest tests/retrieval # seed vectors, assert top-kLatchkey note
Generating embeddings to seed a test index can be GPU-accelerated and slow. On Latchkey, run embedding-heavy tests on GPU or larger runners, cache the embedding model and sample vectors between runs, and auto-retry the transient pulls of the vector-store image or model weights.
Key takeaways
- A vector database indexes and searches high-dimensional embeddings by similarity rather than exact match.
- Approximate nearest neighbor indexes like HNSW make similarity search fast at scale.
- Vector databases power semantic search and RAG, and are tested in CI against an ephemeral seeded store.