What is a vector database?
A vector database stores numerical vectors and makes them searchable by similarity, requiring choices on completeness, response time, and access control.
A vector database is a system that stores vectors, ordered sequences of numbers, and searches for those closest to a given vector. It often holds embeddings, numerical representations produced by a model from text, images, or other content. A question can be converted into a compatible vector and compared with stored vectors: proximity helps find relevant content even when the wording differs. Results depend on the model and the chosen distance measure. Numerical proximity implies neither truth nor permission to read a document. In RAG, a technique that supplies retrieved documents to a generative model, the database can find candidate passages before an answer is produced. A separate product is not required, though; an existing database may also offer vector search. Before choosing, test the options against real data and permissions; a feature demo alone is not enough.
See also: EmbeddingsAn embedding is a numerical representation of content, which lets a system compare it with other content based on the similarity an AI model has learned.
Exact and approximate search
Exact search compares the query with available vectors and returns the nearest according to the chosen distance. An index, a structure built to speed up search, can instead use an approximate method, which cuts work but may miss some close matches. HNSW uses a multilayer graph to find approximate nearest neighbors. Recall is the share of true nearest neighbors returned. Measure it alongside response time, and do not confuse it with relevance to the user.
The documentation for pgvector, an open-source PostgreSQL extension, shows a practical limitation: with an approximate index the filter can be applied after the scan, leaving fewer results than requested. Its example uses HNSW with the default 40 candidates and a filter matching 10% of rows, so about 4 remain on average. Iterative scans, which must be enabled explicitly, can search for more candidates within configured limits. This behavior applies to pgvector, not necessarily to other products.
The sensible choice
Extending a database already in use can make a separate system unnecessary; a dedicated engine adds another component to evaluate. Testing should compare exact and approximate search on the same data, filters, and queries, measuring recall, response time, storage, and updates. Searches for exact codes or names may also need hybrid search, which combines keyword matching with vector comparison.
An enterprise example
A company holding confidential contracts with different clients wants to find similar clauses. It first limits search to documents the user can access, then checks results against a verified list of clauses and an exact search. It also tests highly restrictive filters and checks that revoking access makes derived passages unavailable. For multi-tenant setups, OWASP guidance recommends separate namespaces or indexes and test queries confirming no other client's results come back.
Why it matters for decision makers
Ask bidders how they export vectors and metadata, rebuild the index, and handle updates, copies, and deletions. Vectors are not automatically anonymous: an ACL study inferred sensitive information from text embeddings under experimental conditions. So check permissions, protection, and deletion times on derived copies too.
Frequently asked questions
Related terms
- EmbeddingsAn embedding is a numerical representation of content, which lets a system compare it with other content based on the similarity an AI model has learned.
- RAGRAG combines search and generation: it retrieves external sources relevant to a question and passes them to a language model, which draws on them to answer.
- Hybrid search and rerankingHybrid search combines lexical and semantic results; reranking reorders the candidates by relevance before showing them or passing them to a language model.
If it touches your company's data, getting that data in order is the first thing I do.
See Data Foundations