The short answer
A vector database stores data as embeddings, long lists of numbers that capture the meaning of a piece of text or an image, and finds the items whose meaning is closest to a question. That lets an AI system look up relevant passages even when the words differ, which is how chatbots answer from your own documents. Many products do not need a separate vector database: an extension such as pgvector adds the same search to PostgreSQL.
Key points
- Embeddings turn text into numbers where similar meanings sit close together.
- A vector search finds the closest meanings, not matching words.
- It is the retrieval step behind most "chat with your documents" features.
- PostgreSQL with pgvector is enough for many products.
- Combining meaning search with keyword search often works best.
How it works
- Your documents are split into passages.
- Each passage is turned into an embedding by an AI model: a list of numbers representing its meaning.
- The embeddings are stored with a link back to the original text.
- A question is turned into an embedding the same way.
- The database returns the passages whose embeddings are closest to the question’s.
Because closeness reflects meaning, a question about "cancelling my plan" can find a passage titled "ending your subscription", which a keyword search would miss.
Where it is used
- Answering questions from your own documents, the retrieval step in RAG. See RAG vs fine-tuning.
- Search that understands what people mean, not only what they type.
- Finding similar items: related products, duplicate tickets, similar cases.
- Giving an AI agent memory of relevant past information.
Your options
| Option | Good when | Watch for |
|---|---|---|
| PostgreSQL with pgvector | You already use Postgres and the data fits there | Very large scale needs tuning |
| A dedicated vector database | Very large collections or demanding search speed | Another system to run, sync and pay for |
| Search built into your AI platform | A quick start on a hosted service | Less control over how retrieval works |
Keeping vectors in the same database as the rest of your data has a quiet advantage: access rules, backups and updates stay in one place, so a user cannot retrieve a document they are not allowed to see.
What decides the quality
- How documents are split: passages too long blur the meaning, too short lose context.
- Clean source content: outdated pages will be found and quoted.
- Hybrid search: combining meaning search with keyword search catches names, codes and exact terms.
- Testing: a set of real questions with the passages that should be found.
Agents that answer only from your own content, tested on your real questions, are how we approach AI agent development.
Sources
Checked when this guide was written.