Vector databases: searching by meaning
Picture a library where books are shelved by what they're about, not by title — so to find what you mean, you just walk to the right shelf. A vector database does that for data. It stores embeddings (lists of numbers that capture meaning) and finds the ones nearest your query. The clever part is the index: checking every item is too slow, so it takes a smart shortcut. Explore the search demo, the metrics, and the trade-offs, right here on the page.
01What a vector database is
The AI Data Governance & Quality Assessment — a checklist to keep your data trustworthy.
Get the checklist Browse all templatesYour purchase helps keep our hubs free to read.
Start with a familiar database. A normal one is great at exact matches: find the row where the name equals "Acme", or the orders placed last Tuesday. It works by comparing exact values — words, numbers, dates. But ask it a question like "which articles are about getting a refund?" and it falters, because no single column says "about refunds". To search by meaning, you first turn each item into an embedding — a list of numbers (a vector) that captures what the item is about. A vector database is a database built to store those vectors and to find the ones whose meaning is closest to your query. That's the one new idea: it ranks by similarity, not by exact text.
- A keyword or SQL database matches exact terms or values — perfect for names and IDs, blind to paraphrases.
- A vector database stores embeddings and ranks results by how similar in meaning they are to your query.
- So "how do I get my money back" can surface a "Refund policy" page even with no shared words.
02Exact search vs. the fast shortcut
Here's the heart of a vector database. Every stored item is a point in space; your query is a point too (the green diamond). Finding the closest point is a nearest-neighbour search. The honest way — exact search — checks every point and always returns the true closest. The fast way — an approximate (ANN) index — only follows a short trail through nearby points, so it checks far fewer and is much faster, but it can miss the true closest. Run both below and watch the trade-off. (Points are hand-placed for illustration, not real index output.)
Run a search
The green diamond is your query. Choose Exact to scan every point (always correct, slower) or Approximate to follow a short trail (faster, may miss the true closest).
This is the bargain every vector database strikes. Exact search is correct but slow once you have millions of points; approximate search is fast enough to feel instant but trades a little accuracy. Index structures like HNSW (a navigable graph) and IVF (grouping points into clusters) are clever ways to choose which few points to check — and how often the shortcut lands on the true answer is something you can tune.
03What actually gets stored
A vector database never stores only bare vectors. Each entry is a small bundle: the vector itself (what gets searched), a reference back to the original record (so a match can be turned into a real result), and metadata — tags like source, date, or category that you can filter on. Tap each piece to see why it earns its place.
Vector
The embedding is the part the database actually searches over — a list of numbers that captures the item's meaning. Every similarity comparison happens between vectors; the rest of the entry exists to make a match useful once it's found.
04Measuring closeness — and narrowing the field
"Nearest" needs a definition. A vector database uses a distance or similarity metric to decide which vectors count as closest, and it can filter by metadata before or alongside the search. Switch between the views to see the common metrics and how filtering and hybrid search refine results.
Three common ways to measure closeness
Cosine similarity compares the direction of two vectors and ignores their length — and it ranges from −1 (opposite) to 1 (same direction). Dot product combines direction with magnitude. Euclidean distance is the straight-line gap between two points. The right metric depends on the embedding model you used.
Filtering — narrow before you rank
Because each vector is stored with metadata, you can restrict a search to a subset: only this department, only documents after a date, only items tagged "public". The similarity ranking then runs over just the eligible vectors, so you get matches that are both relevant in meaning and valid by rule.
Hybrid search — meaning plus exact terms
Vector search is strong on meaning but can blur very specific terms; keyword search nails exact terms but misses paraphrases. Hybrid search combines both, so a query that mixes a precise code with a natural-language intent can match on each strength at once.
05Where they fit — and their limits
Vector databases show up wherever ranking by meaning beats matching exact text. Three common homes: the retrieval store in RAG (pull the nearest chunks to ground a model's answer), semantic search (find by intent, not keywords), and recommendations (surface items similar to what someone liked). Several products and tools live in this space — managed services like Pinecone and Weaviate, the open-source library FAISS, and the pgvector extension that adds vector search to PostgreSQL — named here neutrally, not ranked.
- RAG retrieval — the vector database returns the nearest chunks that get added to a model's prompt as grounding context.
- Semantic search — match a natural-language query to items by meaning, so paraphrases and synonyms still find the right result.
- Recommendations — represent items (and tastes) as vectors, then surface the nearest ones as "more like this".
Powerful, but not magic. A few honest limits worth knowing:
- Freshness. New or changed items aren't searchable until they're embedded and added to the index, so there can be a lag between a change and it showing up in results.
- Cost. Holding many high-dimensional vectors and serving fast searches takes memory and compute, which grows with the size of the collection.
- Recall tuning. Approximate (ANN) search may miss a true nearest neighbour; how often it finds the real closest is a setting you balance against speed.
- "Close" isn't always "correct." The nearest vector is the most similar, which is usually but not always the most relevant — a plausible-looking match can still be unhelpful.
06Test your knowledge
07Take it with you & go deeper
Vector database — AI Glossary
The concise definition of a vector database, plus related terms, in the AI Glossary.
Open →Embeddings — AI Glossary
What an embedding is — the vector a vector database stores and searches over.
Open →ANN indexes compared (HNSW vs IVF)
How the major approximate-search index structures work, and the speed/recall trade-offs of each.
Coming soonChoosing a vector database
Managed services, libraries, and database extensions — how to weigh them for your workload.
Coming soon→Continue learning
⊕Concept map
The whole lesson in one expandable tree — open a branch to see the key ideas under it.
What a vector database is
- A keyword or SQL database matches exact terms or values — blind to paraphrases.
- A vector database stores embeddings and ranks results by how similar in meaning they are to your query.
- The one new idea: it ranks by similarity, not by exact text — so "how do I get my money back" can surface a "Refund policy" page.
Exact search vs. the fast shortcut
- Finding the closest vector is a nearest-neighbour search.
- Exact search checks every point and always returns the true closest, but is slow at scale.
- Approximate (ANN) search checks far fewer points to go faster, accepting it can miss the true closest.
- Index structures like HNSW (a navigable graph) and IVF (clustering) choose which few points to check.
What actually gets stored
- The vector — the embedding that the database actually searches over.
- A reference — an id or link back to the original record, so a match resolves to a real item.
- Metadata — tags like source, date, or category that you can filter on.
Measuring closeness — and narrowing the field
- Cosine similarity compares direction only and ranges from −1 (opposite) to 1 (same direction).
- Dot product combines direction and magnitude; Euclidean distance is the straight-line gap.
- Filtering uses metadata to restrict the search to an eligible subset before ranking.
- Hybrid search combines vector similarity (meaning) with keyword matching (exact terms).
Where they fit — and their limits
- Common homes: RAG retrieval, semantic search, and recommendations.
- Freshness: items aren't searchable until embedded and indexed, so there can be a lag.
- Cost: holding many high-dimensional vectors and serving fast searches grows with the collection.
- "Close" isn't always "correct": the most similar vector is usually, but not always, the most relevant.
→Related lessons
Published by Tech Jacks Solutions · Reviewed June 2026. This lesson explains established concepts and is grounded in the references below; figures shown in the interactives are illustrative and labelled as such.
- What is a vector database? — Pinecone (learn)
- pgvector — vector search in PostgreSQL — pgvector (GitHub)
- Weaviate documentation — Weaviate
- Efficient and robust approximate nearest neighbor search using HNSW graphs — Malkov & Yashunin (2016)
- FAISS — a library for efficient similarity search — Meta AI (GitHub)
- Retrieval-augmented generation (RAG) — Pinecone (learn)
Vector databases — in 5 minutes
Tech Jacks Solutions · AI Knowledge Hub · educational summary
What a vector database is
A normal keyword or SQL database matches exact terms or values, so it can't rank results by meaning. A vector database stores embeddings (vectors that capture meaning) and finds the ones most similar to a query, so a search ranks by meaning rather than exact text.
Exact search vs. the fast shortcut
Finding the closest vector is a nearest-neighbour search. Exact search checks every point and always returns the true closest, but it gets slow at scale. An approximate (ANN) index checks far fewer points to go much faster, accepting that it can occasionally miss the true closest — that is the core speed/accuracy trade-off. HNSW (a navigable graph) and IVF (clustering) are common ANN index structures.
What gets stored
Each entry bundles the vector (what gets searched), a reference back to the original record (so a match resolves to a real result), and metadata such as source or date (which you can filter on).
Metrics, filtering & hybrid search
A metric defines "nearest": cosine similarity compares direction and ranges from −1 (opposite) to 1 (same direction); dot product combines direction and length; Euclidean distance is the straight-line gap. Filtering uses metadata to narrow the candidate set, and hybrid search combines vector similarity with keyword matching.
Where they fit & limits
Uses: RAG retrieval, semantic search, and recommendations. Tools include Pinecone, Weaviate, FAISS, and pgvector (named neutrally). Limits: freshness (new items aren't searchable until indexed), cost (memory/compute grow with the collection), recall tuning (ANN may miss a true neighbour), and "closest" is not always "most relevant".