Vector DB
Summary
A vector database is a specialized storage system for quickly finding semantically similar vectors. The heart of any RAG system.
Why Do You Need It
A traditional database searches for exact matches: "cat" won't find "kitten". A vector database stores embeddings and can search based on semantic similarity.
| Traditional DB (SQL) | Vector DB | |
|---|---|---|
| Search Type | Exact text match | Semantic similarity search |
| Finds "kitten" for query "cat" | No | Yes |
| Typical Use Case | Structured data | RAG, semantic search |
How It Works
- Each document is converted into a vector.
- Vectors are stored in the database.
- When a query is made, its vector is compared to the stored vectors.
- The database returns the closest matches (based on cosine similarity and others).
Which One to Choose
| Database | When to Choose |
|---|---|
| Qdrant | Production, high requirements, metadata filtering |
| Pinecone | Managed cloud, easy setup without administration |
| pgvector | Already have PostgreSQL, up to 1-2 million vectors |
| ChromaDB / FAISS | Prototypes, local development |