Vector Databases & RAG Explained: How Intelligent Search Actually Works

Vector Databases & RAG Explained: How Intelligent Search Actually Works

When you talk about RAG (Retrieval-Augmented Generation), one piece that's absolutely central to it is the vector database. And there are quite a few variants of vector databases out there, which confuses a lot of people.

Series: My AI Journey (2 articles)

  1. 2
    Vector Databases & RAG Explained: How Intelligent Search Actually Works This article
Software Developer
A lot of people also have doubts about how "intelligent search" actually happens inside a vector database. So in this article, I'm going to cover: what a vector database for RAG actually is, how intelligent search works inside it, and what the real difference is between normal keyword search and intelligent search. These are exactly the kinds of questions that come up when you go for an AI engineer interview — how keyword search works, how intelligent search works inside a vector space, and how vectors are generated in the first place.
I'll also cover what's available in open source for building a vector database — what's serverless, and what server-based DBs exist. All of this you can build very easily in Python.

Databases You Already Know vs. Vector Databases

We normally use databases in plenty of applications — SQL, Postgres, these are relational databases. What do we call a non-relational database? MongoDB. Now, is a relational database and a non-relational database the same thing? Not at all.
That said, the core concept is the same — at the end of the day, both are going to store data. But what gets stored inside is different:
  • SQL / Postgres → stores data in tables (rows and columns)
  • MongoDB → stores data in JSON format (flexible documents)
  • Vector DB → stores data as chunks — and inside each chunk is a vector, which is just a set of numbers
That's it. A vector is simply a list of numbers that represents the meaning of a piece of text.

How Does a Vector Database Actually Work?

It all comes down to intelligent search. And there's a massive difference in the market between intelligent search and what we normally call keyword search.
Here's some context: until a few years ago, Google Search used to run almost entirely on a keyword basis. That's exactly why people doing SEO were told to stuff high-volume keywords into their blog posts — because Google's ranking engine was running on a keyword-matching algorithm. That's the whole reason that SEO advice existed.
But Google changed. They moved toward intelligent search — searching based on the meaning of a word, not just whether the exact keyword is present.

Let's Visualize It

Imagine you take any vector DB, and inside it you've stored vectors for three words: apple, orange, and banana. Each of these gets converted into a vector and plotted on a graph. Since all three are fruits, their vectors end up clustering near each other in that space.
Here's the difference between the two search types:
Keyword search: You ask, "What are all the fruits available?" Keyword search takes the literal word "fruits" and checks — is the exact word "fruit" present anywhere in the stored data? It isn't (the data only has "apple," "orange," "banana" — never the word "fruit" itself). So keyword search returns zero results. If you'd used a more specific, directly matching word like "apple" in your question, it might've picked that up — but without an exact match, keyword search simply can't perform.
Intelligent search (a.k.a. semantic search): This is the one that solves the problem above. Your question — "What are all the fruits available?" — also gets converted into a vector. When that vector gets plotted on the same graph, the word "fruit" lands automatically close to apple, orange, and banana — because their meanings are related, even though the exact words don't match.
Because it lands nearby, RAG uses a component called a retriever, where you set a value called k — how many chunks should be returned. If you set k=3, it retrieves the 3 nearest vectors and returns them. So when you ask "What are all the fruits available?", you get back: apple, orange, banana — fetched purely based on meaning, not exact word matching.
This is the core difference between keyword search and intelligent search. In the industry, intelligent search also goes by another name: semantic search. Intelligent search and semantic search are the same thing — just different names for it.

Can You Do CRUD Operations on a Vector DB?

If you're used to normal SQL, you'd expect full CRUD (Create, Read, Update, Delete) support. In a vector DB, the answer is: not 100%.
You can't do full in-place CRUD the way you can in SQL. Instead, you typically build an external manager — in Python, for example — that handles updates. So when a source PDF changes, your external manager re-chunks the updated document and refreshes the embeddings in the vector store accordingly. It's a layer you build around the vector DB, not something built into it natively.

Open Source vs. Closed Source Vector Databases

A common doubt: is a vector DB only available as closed-source/paid tools, or is open source available too? Good news — there's solid open source available.

Serverless (Open Source) Options

FAISS and ChromaDB are two fully open-source vector databases. Both are "serverless" — meaning when you build your RAG application, the vector DB gets created as a local file right inside your project folder:
  • FAISS → stored as a  .faiss  file
  • ChromaDB → stored as a  .db  file
All your vectors and chunks get stored directly in that file. No external server, no vendor involved.
  • FAISS was developed by Facebook (Meta).
  • ChromaDB is a separate, independent company/project.
Both are 100% usable, and there's no artificial storage limit — your limit is simply your own machine's disk space. You can push well over 10GB of data into either of these if your system can handle it.

Server-Based (Managed) Options

If your company doesn't want a serverless setup and specifically wants a managed server DB, the most common choice is Pinecone. You go to the Pinecone platform, create your database, and it gives you an index ID and an API key. Using those, you build your RAG application, and all your vectors get stored in Pinecone's own cloud database — not locally on your machine. This comes with usage-based charges.
Qdrant is another option in this same category — it also has an official hosted platform where you can create and store your DB.

Which One Do Companies Actually Use?

Most IT companies — especially larger enterprises — prefer server-based DBs like Pinecone or Qdrant, for managed scaling. Startups and mid-level companies tend to prefer serverless DBs like FAISS or ChromaDB, since there's zero ongoing cloud database cost.
If you're an AI engineer, it's worth learning both — but here's the good news: once you understand serverless, server-based is easy to pick up. The core concept barely changes. Instead of the DB storing data locally, it stores it in a remote location, and you connect to it using an API key from that platform. That's really the only structural difference — maybe a 0.1–1% change in how you work with it.

Why the Difference Still Matters

There's a real tradeoff here. Say you bought a Pinecone database, built your vector DB on it, and deployed your RAG application into production. If Pinecone ever goes down, your application crashes in production — you now have a third-party dependency you don't control.
With a serverless DB, as long as your own VM (virtual machine) stays up, it keeps running — you don't have that external-outage risk at all. That's the major tradeoff between the two approaches.

The End-to-End RAG Flow

Here's the complete pipeline, from raw documents to an answer:
  1. Data Ingestion — load in your raw documents (PDFs, text files, whatever your source is).
  1. Text Splitting (Chunking) — break large documents into smaller, manageable chunks.
  1. Embeddings — pass each chunk through an embedding model to convert it into a numerical vector.
  1. Vector Store — store those vectors (and their corresponding text chunks) inside your chosen vector DB.
  1. Retriever — convert the incoming user query into a vector, plot it in the same space, and pull back the top-k nearest chunks as context for the LLM.
This is the backbone flow of any RAG system.

Choosing the Right Embedding Model

For your RAG application to actually perform well, your vectors need to be generated accurately — and that comes down to which embedding model you choose. There are plenty of options: OpenAI has models like text-embedding-ada and smaller variants like text-embedding-3-small, and Hugging Face has models like MiniLM.
Here's the key fact worth remembering: whichever embedding model has a larger vocabulary size will generate vectors more accurately.
This is actually a common interview question — if they ask "which embedding model generates better vectors," the answer is simply: the one with the higher vocabulary size, because that directly improves accuracy in vector generation.

Wrapping Up

So, to summarize everything you need to know about vector databases — for both building real RAG systems and for interviews:
  • Vector DBs store chunks + vectors, unlike SQL (tables) or MongoDB (JSON documents)
  • Intelligent/semantic search retrieves by meaning, while keyword search only matches exact words
  • Vector DBs don't support full native CRUD — you manage updates externally
  • FAISS and ChromaDB are open-source, serverless options stored as local files
  • Pinecone and Qdrant are managed, server-based options accessed via API key
  • The RAG flow is: Ingestion → Chunking → Embeddings → Vector Store → Retriever
  • A higher-vocabulary embedding model generates more accurate vectors
I hope this gives you real clarity on vector databases. If you found this useful, let me know in the comments, and tell me what topics you'd like covered next.


If this was useful, follow along for more AI breakdowns like this.

Series: My AI Journey (2 articles)

  1. 2
    Vector Databases & RAG Explained: How Intelligent Search Actually Works This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article