MohitDecodes
Back to blogsAI

Embeddings and Vector Databases Explained Without the Math Overload

November 17, 2026 · 6 min read

Traditional SQL `LIKE '%refund%'` search fails the moment a user types "how do I get my money back?". Embeddings solve this by turning meaning into numbers so similar ideas sit close together in vector space.

What an embedding actually is

An embedding model takes a sentence or paragraph and outputs a fixed-length array of floating-point numbers (for example, 768 or 1,536 dimensions). Sentences with similar intent produce vectors pointing in nearly the same direction, which we measure using **cosine similarity**.

Why chunking matters more than which vector DB you pick

  • Split long documents into 300–600 token chunks with 10–15% overlap so answers don't get cut in half at paragraph boundaries.
  • Store metadata alongside each vector (source URL, title, category) so you can filter before similarity search.
  • For small datasets (under 50k chunks), PostgreSQL with `pgvector` keeps your stack simple without adding another database.
// Conceptual semantic search flow
const queryVector = await embed("how to reset my password");
const topChunks = await vectorStore.query(queryVector, { topK: 5 });