Hi all. Vector search is the AI feature that landed straight inside our databases: Oracle, SQL Server 2025, PostgreSQL with pgvector. To understand it you only need two ideas, embeddings and distance. Both are simpler than they sound.
An embedding is meaning, as numbers
An embedding model is a small AI model that reads a piece of text and returns a fixed-length list of numbers. That list is a vector. The model I use in my lab, nomic-embed-text, returns 768 numbers for any text, a word or a whole page.
The trick: texts with similar meaning get vectors that are close to each other. "Two sessions waiting on each other" lands right next to "deadlock", even though they share no words. "RMAN backup failed" lands somewhere else entirely.
LIKE '%deadlock%' finds the word. Vector search finds the meaning. It's the difference between searching your incident notes for a keyword and asking a colleague "have we seen something like this before?"
Two rules that matter later: you must use the same embedding model for your data and for the question, and if you change the model, you re-embed everything. Old and new vectors don't mix.
Distance: how "close" is measured
To find similar rows, the database computes the distance between the question's vector and each stored vector. The common ways are cosine (the angle between them, the usual choice for text), Euclidean (straight-line distance) and dot product. Smaller distance, closer meaning. The same query in all three engines:
-- Oracle AI Database 26ai
SELECT title FROM runbooks
ORDER BY VECTOR_DISTANCE(embedding, :q, COSINE)
FETCH FIRST 3 ROWS ONLY;
-- SQL Server 2025
SELECT TOP (3) title FROM runbooks
ORDER BY VECTOR_DISTANCE('cosine', embedding, @q);
-- PostgreSQL + pgvector (<=> is cosine distance)
SELECT title FROM runbooks
ORDER BY embedding <=> $1
LIMIT 3;
The column types are just as familiar: VECTOR(768, FLOAT32) in Oracle, VECTOR(768) in SQL Server, vector(768) in pgvector.
A vector index is not a B-tree
Without an index, the query above compares the question with every row: an exact search, a full scan. Fine for ten thousand rows, slow for ten million. A B-tree can't help, because there's no sort order for "close in 768 dimensions".
So vector indexes do approximate nearest-neighbor search. They give up a little accuracy (maybe not the true top 3, but very close) for a big speed-up. That's new for DBAs: an index that can return a slightly different answer than a full scan.
| Engine | Vector index types | DBA notes |
|---|---|---|
| Oracle AI Database 26ai | HNSW (in-memory graph), IVF (partitions), plus hybrid vector indexes that mix text and vector search | HNSW lives in the vector memory pool, so size VECTOR_MEMORY_SIZE |
| SQL Server 2025 | DiskANN, created with CREATE VECTOR INDEX | Vector index and VECTOR_SEARCH are still preview features and need PREVIEW_FEATURES turned on |
| PostgreSQL + pgvector | HNSW and IVFFlat | HNSW: better recall, slower build, more memory. IVFFlat: build it after the data is loaded |
What this means for a DBA
- Storage: 768 float32 numbers are about 3 KB per row, before the index.
- Memory: graph indexes like to sit in memory. Plan for it like you plan the buffer cache.
- Accuracy: test recall. Compare indexed results with an exact search on a sample.
- Model changes: a new embedding model means re-embedding and rebuilding. Treat it like a migration.
- Embedding calls: creating vectors costs CPU or API calls. Who calls the model, from where, with which network access?
Official reading
- Oracle: AI Vector Search User's Guide, VECTOR_DISTANCE, vector indexes
- SQL Server: VECTOR data type, VECTOR_DISTANCE, CREATE VECTOR INDEX
- PostgreSQL: pgvector
Next: should vector search live in your database, or in a separate vector database? What would you search by meaning first, incident notes or runbooks?
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