Vector Database
A database optimised for storing and searching high-dimensional vectors (embeddings).
Step 1 of 5
Store vectors
Each chunk's embedding is stored next to its metadata, for example source, section and who may read it.
Approximate search trades a little recall for a lot of speed.
Simple explanation
A vector database stores embeddings and lets you search for the most similar vectors quickly. Instead of exact SQL queries, you ask 'find me the 5 most similar items to this vector'.
Engineering explanation
Vector databases use approximate nearest neighbour (ANN) algorithms (HNSW, IVFFlat) for sub-linear search. Options: pgvector (Postgres extension — keeps vectors next to metadata, enables SQL-level RBAC filtering), Pinecone (managed), Qdrant (self-hosted), Weaviate. Production RAG often uses pgvector to avoid a separate database.
Example
Store 50,000 document embeddings in pgvector → query with an HNSW index → get the top 5 matches back in milliseconds, not a full scan.
When to use it
Any RAG or semantic search system with more than ~1000 documents. Below that, brute-force cosine similarity is fine.
Common misconception
You don't ALWAYS need a dedicated vector DB. pgvector handles millions of vectors and keeps your data in one place. Don't add Pinecone/Qdrant until you need to.