Hi all. Here's where vector search starts paying off. A model on its own only knows what it learned in training, and nothing about your systems. RAG (retrieval-augmented generation) fixes that: before the model answers, you retrieve the right pieces of your own documents and put them in its context window. The model answers from those, and can show where the answer came from.
For DBAs that's runbooks, past incident notes, architecture docs, vendor notes. "How do we fail over the billing database?" answered from our runbook, not from a blog post somewhere.
The five steps
- Chunk. Split the documents into pieces of a few hundred words. Too big and the search gets fuzzy; too small and the answer loses context.
- Embed. Turn every chunk into a vector with an embedding model (see part 3).
- Store. Put text, vector and metadata (source, date, owner) in a table with a vector index.
- Retrieve. Embed the question and fetch the top few closest chunks.
- Generate. Send the question plus those chunks to the model: "Answer only from these sources, and name them."
Steps 1 to 4 are database work. That's why the database vendors are all over it.
How the databases do it
| Database | The building blocks |
|---|---|
| Oracle | The DBMS_VECTOR_CHAIN package does the pipeline in PL/SQL: UTL_TO_TEXT, UTL_TO_CHUNKS, UTL_TO_EMBEDDINGS, even UTL_TO_GENERATE_TEXT. On Autonomous Database, Select AI with RAG wraps it all up. |
| SQL Server 2025 | AI_GENERATE_CHUNKS splits text, AI_GENERATE_EMBEDDINGS calls a model you registered with CREATE EXTERNAL MODEL, and VECTOR_DISTANCE does the retrieval. |
| PostgreSQL | pgvector stores and searches; chunking and the model call usually live in the application. On Azure, the azure_ai extension can call models from SQL. |
RAG is a lookup before the answer. Like checking the data dictionary before writing a query, instead of guessing the column names from memory.
Where it breaks
- Old documents. The runbook from before the migration is still in the index, and the model happily quotes it. Store dates, and remove or re-embed what's outdated.
- Permissions. The chunk table is a copy of your documents. If HR files go in, everyone who can query the chunks can read HR. Same rules as the source: row-level security, VPD, separate tables.
- Bad chunks. A table split in half, a procedure cut in the middle. Retrieval finds half the truth.
- Text that gives orders. A document can contain "ignore your instructions and..." That's prompt injection, and it arrives through retrieval. The Supabase MCP case shows how that looks with real data.
- No sources. If the answer doesn't name its chunks, you can't check it. Ask for sources every time.
Official reading
- Oracle: Select AI with RAG, DBMS_VECTOR_CHAIN
- SQL Server: AI_GENERATE_CHUNKS, AI_GENERATE_EMBEDDINGS
- PostgreSQL: pgvector, azure_ai extension
- Risks: OWASP LLM01: Prompt Injection
Next: text-to-SQL, when you ask the database a question in plain English. Which documents would you feed a DBA assistant first?
All parts, in one place: New to AI? And if you want every AI word mapped to something DBAs already know, start with You Already Speak AI (also for SQL Server and PostgreSQL).


Comments
Post a Comment