Vector Database
A database optimised for storing and searching high-dimensional vectors (embeddings).
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 HNSW index → get top-5 in <50ms.
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.