Articles

What Is a Vector Database? Search by Meaning, Explained

A vector database stores embeddings and finds information by meaning, not keywords — the backbone of AI search and RAG. Here's how vector databases work.

Chisato Chisato · · 3 min read
Stacked database cylinders

A vector database is a database built to store and search embeddings — numerical representations of meaning — so you can find information by similarity instead of exact keywords. Search for “how do I reset my password” and a vector database can surface a document titled “account recovery steps,” even though they share almost no words. This ability to search by meaning is what powers modern AI search, recommendations, and retrieval-augmented generation.

Embeddings: turning meaning into numbers

The key idea is the embedding. An embedding model (a cousin of the large language model) converts a piece of text — a sentence, a paragraph, a document — into a long list of numbers called a vector. The magic is that similar meanings produce nearby vectors. “Dog” and “puppy” land close together in this mathematical space; “dog” and “spreadsheet” land far apart.

Once your data is represented as vectors, “find related content” becomes “find the nearest vectors” — a geometry problem the database is optimized to solve.

How a vector database works

Two pieces do the heavy lifting:

  • Similarity metrics. To compare vectors, the database measures the distance (or angle) between them — cosine similarity is the most common. The closest vectors are the most semantically related.
  • Approximate nearest neighbor (ANN) indexes. Comparing a query against millions of vectors one by one would be far too slow. Vector databases use specialized indexes — HNSW is the best known — that find the closest matches in milliseconds by trading a tiny amount of accuracy for an enormous amount of speed.

The typical workflow:

  1. Embed your documents and store the vectors (plus metadata) in the database.
  2. At query time, embed the user’s query with the same model.
  3. Ask the database for the k nearest vectors.
  4. Return those results — often to an LLM to generate a grounded answer.

Where vector databases are used

  • RAG — the dominant use case: retrieving relevant context to ground an LLM’s answer in your own data.
  • Semantic search — search that understands intent, not just matching words.
  • Recommendations — “find items similar to this one.”
  • Deduplication and clustering — grouping near-identical or related content.

Vector database vs. traditional database

A relational database like PostgreSQL excels at exact, structured queries: “all orders over $100 from June.” A vector database excels at fuzzy, semantic ones: “documents that mean roughly this.” They’re complementary, not competing — and increasingly you don’t even need a separate system. Postgres with the pgvector extension adds vector search to a database you may already run, part of the broader rise of developer-friendly databases. Dedicated options like Pinecone, Weaviate, Qdrant, and Milvus offer more scale and vector-specific features.

Relational databaseVector database
Finds data byExact values and filtersSemantic similarity
Query example”orders where total > 100""passages similar to this question”
Core indexB-treeANN (e.g., HNSW)

The takeaway

A vector database stores meaning as numbers and finds matches by closeness, which is exactly what AI applications need to connect a user’s question to the right information. If you’re building search, recommendations, or especially RAG, a vector store — whether a dedicated engine or a pgvector-equipped Postgres — is the component that lets your app retrieve by meaning instead of guessing at keywords.

Chisato Chisato · · 4 min read

What Is a Knowledge Graph?

A knowledge graph stores facts as entities and labeled relationships instead of rows or documents, letting queries traverse connections directly.

#AI #Databases #LLMs
Chisato Chisato · · 4 min read

What Is Prompt Chaining? Multi-Step LLM Pipelines

Prompt chaining splits a task into a sequence of smaller LLM calls, each one feeding the next, instead of asking one giant prompt to do everything.

#AI #LLMs #Developer Tools