What Is a Vector Database? Finding Similar Items with Embeddings
A vector database stores numeric arrays called embeddings and ranks items by how close their vectors are. It can find documents with similar meaning even when they use different words, or retrieve similar images and other unstructured content. Similarity is not correctness or proof of fact, however, so design keyword and metadata conditions and result review alongside vector search.
What is a vector, and how is it searched?
An embedding is a model’s fixed-length numeric representation of input such as text or an image. If a model is trained to represent similar inputs with similar vectors, a system can calculate vector distances and find nearby candidates. Metrics include cosine distance, Euclidean distance, and inner product; lower distance and higher similarity do not have the same direction for every metric. The embedding model and the metric used for retrieval need to be compatible.
Imagine searching customer-support documents. Split documents into suitable passages, embed each passage, and store its vector with an ID and metadata such as source text or reference, language, and product version. Embed the user’s question with a compatible model and retrieve nearby passages. If the results go to a generative model, they are reference material for its answer; citation, access checks, and evidence review are separate steps.
Document passage → embedding model → stored vector + metadata
Question → same embedding model → query vector → nearest candidates → filters/reviewThis flow is explanatory; no particular model was run and no quality was measured. Changing models can change the vector space, so do not directly compare vectors from incompatible models in one index. Plan for re-embedding and index replacement.
How does vector search differ from keyword search?
Keyword search ranks using lexical signals such as how often query terms appear. It is strong when wording must match exactly, such as product codes, error messages, or legal terms. Vector search uses embedding distance to find semantically close candidates, which can help with paraphrased questions, cross-language retrieval, or image similarity. It does not automatically know domain-specific meaning or current facts that the model missed.
Hybrid search can combine lexical and vector scores when both strengths matter. For example, a search for “black dog breed” could consider both documents containing the exact word black and passages like “dark-colored canine.” Combination methods and weights differ by product, and hybrid search is not guaranteed to beat simple keyword matching when an exact SKU or code matters.
Do you need a separate vector database?
A dedicated vector database may provide vector indexes, similarity queries, metadata filters, and distributed operations as core features. An extension such as pgvector for PostgreSQL can keep vectors alongside ordinary rows and retain SQL, transactions, and relational features. If data already lives in your relational database and scale and operations are manageable, an extension may be simpler. A dedicated product is worth comparing when high retrieval throughput, distributed scaling, or vector-specific operations matter.
| Approach | When it may fit | What to check |
|---|---|---|
| Existing DB plus vector extension | Keep relational data and vectors in one SQL/transaction system | Index memory, approximate-search quality, result count after filters, extension version |
| Dedicated vector DB | Vector retrieval is central; horizontal scaling, filtering, and operations matter | Product-specific index/metadata model, backup/recovery, tenant isolation, and cost |
| Keyword or hybrid search | Exact terms matter or lexical and semantic signals should be combined | Index updates, score fusion, relevance evaluation, and thresholds |
How do indexes and filters affect results?
Exact nearest-neighbor search compares every vector, so computation grows with the dataset. Approximate nearest-neighbor (ANN) indexes search only some candidates to gain speed, but may return different neighbors from exact search. pgvector documents exact search as the default; adding indexes such as HNSW or IVFFlat changes retrieval to approximate search, trading some recall for speed. HNSW can offer a useful speed-recall balance but builds more slowly and uses more memory; IVFFlat builds faster and uses less memory but has a different search-quality trade-off. Measure against your data and workload.
Metadata filters matter too. If a person may search only documents they are authorized to see, removing unauthorized results after vector retrieval may not be sufficient. With approximate indexes, post-filtering can leave fewer matching results than requested. Products differ in prefiltering, iterative scans, partitioning, and their quality characteristics. Include authorization and tenant filters in query design and separately check missing results, recall, and isolation under restrictive filters.
A similarity score alone does not guarantee relevance. A search system returns the closest items, so it may return a “best” result even when every candidate is unsuitable. Combine a result limit, distance threshold, metadata filters, keyword search, or a reranker, and evaluate precision and misses on a dataset representing real use.
What should you check before adopting one?
Decide how to handle source content, embedding model and version, vector dimensions, distance metric, metadata, and reindexing. Prepare representative questions and examples of relevant documents judged by people; evaluate relevance and recall, including result counts before and after filters. Then consider write rate, concurrent queries, growth, memory and storage, backup/deletion/recovery, and the re-embedding cost of model changes.
A vector database is useful when finding semantically similar material is central and you can evaluate result quality. For exact string search or relational joins, an existing search engine or relational database may be more direct; test hybrid retrieval when both kinds of signals matter. An embedding helps retrieve candidates; it does not prove truth, freshness, or access rights. Keep those checks as separate application responsibilities.
Sources and scope
[Weaviate: Vector search](https://docs.weaviate.io/weaviate/concepts/search/vector-search)
[Weaviate: Keyword, vector, and hybrid search](https://docs.weaviate.io/weaviate/concepts/search)
[Weaviate: Filtering vector search](https://docs.weaviate.io/weaviate/concepts/filtering)
[pgvector official README: exact/approximate search and indexes](https://github.com/pgvector/pgvector)
Official Weaviate and pgvector documentation was checked on 2026-11-22. Search quality and index behavior depend on product version, model, data distribution, and configuration; product-specific behavior is not generalized to all vector databases. The document-retrieval flow is illustrative; no query or benchmark was run.