What is a vector database?
Get its filtering wrong in a multi-tenant product and one customer's assistant quietly answers from another customer's files.
Vector database
Vector storeEmbedding database
A vector database stores text, images or audio as embeddings, which are lists of numbers that capture meaning. It returns the stored items whose numbers sit closest to those of a query.
An embedding model turns a passage into a long list of numbers. Passages about similar things land near each other. So a search for "time off after a birth" finds a paragraph titled "parental leave". Keyword search would miss it.
Nearest is not the same as correct. The database ranks by distance, so it always returns something, even when nothing stored actually answers the question.
Where it fits in an AI product
Most assistants use one as the retrieval step. Documents are split into chunks, embedded once, and stored. A question is embedded the same way, and the closest chunks go to the model as context.
You do not always need a separate product. Postgres with the pgvector extension keeps embeddings beside the rows they belong to. That means one backup, one access model, one thing to run. Dedicated engines earn their place at large scale, or where filtering is heavy.
- ChunkSplit so a table stays whole
- EmbedText becomes a number list
- StoreWith tenant and access tags
- QuerySame model embeds the question
- FilterRestrict before the scan
- RankNearest neighbours returned
Query and documents must use the same embedding model. Swap it and every stored vector needs rebuilding.
01Do I need a dedicated vector database?
Most products do not, at least not at first. If your data already lives in Postgres, pgvector keeps embeddings next to the rows they describe. One backup and one access model then cover both. Move to a dedicated engine when scale or filtering forces it, not because the tool is new.
02What is the difference between a vector database and a search engine?
Vector search matches meaning, keyword search matches words. A keyword engine finds "parental leave" only when those words appear. Vector search finds it from "time off after a birth". Good retrieval runs both and merges the results, because exact strings like part numbers defeat embeddings.
03Why does my vector search return irrelevant results?
Distance ranking always returns the nearest entries, so an empty or off-topic corpus still yields confident matches. Three causes are common. Chunks that split a table or a clause in half. No similarity threshold set. Different embedding models used for documents and for queries.

