Vector database
Definition
A vector database stores high-dimensional vectors alongside metadata and answers similarity queries (top-k nearest neighbours), typically using approximate nearest-neighbour indexes such as HNSW or IVF.
In practice
It is the retrieval layer of RAG and semantic search. Beyond the ANN index it provides metadata filtering during the search (tenant, permissions, document type), upserts and deletes, replicas for read throughput and sharding when the vectors no longer fit in one node's memory. Capacity planning starts from memory: vectors × dimensions × bytes per dimension plus graph overhead.
A separate vector database is not always needed: PostgreSQL with pgvector, search engines and many document stores support vector indexes, which keeps data, permissions and transactions in one place. Post-filtering results after the search is a classic pitfall, because it silently returns fewer than k matches for selective filters.
Example
A tenant-scoped query asks for the top 20 chunks nearest the question vector with filter tenant_id = 42, returning in 15 ms from an HNSW index of 30 million vectors spread over 4 shards.