Vector Database

Vector Database

A vector database stores text, images, and other data as numerical vectors (embeddings) and provides fast search based on semantic similarity.

Traditional relational databases search by keyword matching. Searching for "dog" returns rows containing the string "dog" but misses "puppy" or "canine." Vector databases break through this limitation by converting text into vectors of hundreds to thousands of dimensions using embedding models and searching by "semantic distance" from the query.

Demand surged alongside the proliferation of RAG (Retrieval-Augmented Generation). To feed external knowledge to an LLM, relevant documents must first be retrieved at speed. Vector databases serve as the infrastructure for this search layer.

Major implementations include purpose-built databases like Pinecone and Weaviate, and extensions to existing databases like PostgreSQL's pgvector. pgvector is also integrated into Supabase, offering the advantage of embedding vector search within existing RDB operational workflows.

HNSW (Hierarchical Navigable Small World) is widely used as an indexing algorithm. The trade-off between search accuracy and speed, along with chunk size design and metadata filtering, are where practical expertise makes a difference.