GuidesUnderstanding AI
Vector database: what it is for
What it does
A classic database answers “which rows contain this word?”. A vector database answers “which texts mean roughly the same thing?”.
- 1IndexEach passage becomes an embedding, stored with its text and metadata.
- 2QueryThe question becomes a vector with the same model.
- 3FilterLanguage, customer, date: narrow down before comparing.
- 4ReturnThe nearest passages, with their score.
The options
| Option | When to choose it |
|---|---|
| pgvector (PostgreSQL) | Your data is already there, reasonable volume |
| Qdrant, Weaviate | Large volumes, rich filters, self-hosting possible |
| Pinecone | Managed service, no server to maintain |
| Chroma | Prototype, local tests |
Common mistakes
- Passages that are too long, which dilute the meaning.
- Forgetting metadata, then being unable to filter.
- Changing embedding model without re-indexing everything.
How it all fits together: RAG, AI on your documents.
Frequently asked questions
- Do you need a dedicated database?
- Not necessarily. If your data already lives in PostgreSQL, the pgvector extension is enough for many projects. A dedicated database makes sense with large volumes or advanced search needs.
- Is the search exact?
- Usually approximate: an index such as HNSW finds very close neighbours very fast, without guaranteeing the absolute closest. In practice the gap is minimal.
- Can you filter by language or by customer?
- Yes. Each vector carries metadata (language, customer, date) that filters the search. It is essential so that two customers’ data never mix.