Start here
Vector Database in plain language
The embedding model creates the representation; the database stores and searches it. A language model may then use the retrieved text to produce an answer. These are separate responsibilities, and many search applications need no answer-generating model.
A useful choice depends on more than collection size. Consider updates, metadata filtering, query latency, retrieval quality, backup, access control and the team’s operating experience. An existing database with vector support may fit better than introducing another service.
How it works
Store records
Save a vector with an identifier and enough metadata to find the original item and its current version.
Search and filter
Apply required filters and a similarity query. Exact and approximate search offer different performance and recall trade-offs.
Return source material
Resolve result identifiers to permitted content. Check ranking quality and whether relevant items were missed.
Illustrative example · Fictional data
Searching a product manual collection
- Input
- Fictional manuals for device models A and B, each with two revisions. A user asks how to reset model B on the current revision.
- Process
- Filter by model and supported revision, then search for the reset procedure. Retain passage identifiers and document links.
- Expected output
- Return the correct model B procedure with its source. A similar model A passage should not be accepted simply because its vector is close.
- How to check it
- Test the filter with confusing model names. Compare approximate results against an exact-search baseline where practical and measure whether relevant passages are retained.
Where it helps
- Semantic document retrieval for a knowledge assistant.
- Similarity search across images, text or products.
- Finding candidate duplicates for later verification.
Dedicated service or existing database?
- Existing database with vectors
- Can keep business records, filters and vector search together. Check indexing and operational requirements.
- Dedicated vector service
- May suit particular search workloads and operational needs. Compare features, cost and integration effort.
- In-memory search
- Useful for a small experiment when durability and concurrent access are not needed.
Common pitfalls
- Approximate search may trade some recall for speed; inspect that trade-off with your own queries.
- A similarity score is not a probability that a result is correct.
- A metadata filter is only as reliable as the application’s identity, authorisation and metadata maintenance.
Put the idea to work
Try it yourself
Sketch a record containing document ID, passage, model version, department and embedding. List which fields must be filters and which should influence similarity. Explain how an outdated passage would be removed.
Common questions
Can PostgreSQL store vectors?
Yes. The pgvector extension supports vector storage and similarity search in PostgreSQL. Suitability depends on the workload and operating requirements. Using PostgreSQL can simplify operations if your data already lives there. Dedicated vector databases may suit very large collections or heavy filtered search loads.
How does a vector database differ from a search engine such as Elasticsearch?
The distinction is no longer “one does keywords, the other does vectors”. Established search engines support dense-vector fields and approximate nearest-neighbour search alongside their keyword scoring, and purpose-built vector services have added metadata filtering and keyword or hybrid ranking. Choose on the properties your workload needs. A search engine may suit you when the corpus already lives there, when lexical matching on identifiers, codes and proper nouns carries real weight, or when you want one system for both ranking styles. A dedicated vector service may suit you when the collection is large enough that index type, memory behaviour and recall-versus-latency tuning become the dominant concern, or when filtered vector search at scale is the main query pattern. Weigh the operational side honestly too: running another datastore means another thing to size, back up, upgrade and staff. Test both on your own documents and queries — published benchmarks rarely match your filter patterns or update rate.
Does a vector database generate embeddings?
Some products integrate embedding services, but vector storage and embedding generation are distinct tasks. Check which component owns each in your design. Typically an embedding model converts text into vectors, and the vector database stores, indexes and searches them. Using the same model for documents and queries is essential.
Is a vector database the same as RAG?
No. It can supply retrieval for RAG, but RAG also includes generation using retrieved evidence. Vector search has other uses too. Vector search also powers recommendations, duplicate detection, image search and clustering. In RAG, retrieved passages are added to the prompt so the model can ground its answer.
Your next step
Continue learning
Connected concepts
Sources and further reading
Examples on this page are teaching exercises using fictional information. They are not client case studies or measured outcomes.
