26aiVector SearchSQL

FETCH FIRST isn't always exact in Oracle AI Database 26ai vector search

Once a vector index exists, a plain FETCH FIRST similarity query can use it and return approximate results. FETCH EXACT FIRST guarantees an exact search.

A small keyword changes your results in Oracle AI Database 26ai vector search. I ran the same similarity query twice on 26ai Free, with an IVF vector index in place:

  • FETCH FIRST 5 ROWS ONLY: the plan used the index, and returned different rows.
  • FETCH EXACT FIRST 5 ROWS ONLY: a full scan, and the true nearest neighbours.

Oracle's documentation says it plainly: without EXACT, an approximate search through a vector index is attempted if one exists.

Which one to use

  • FETCH EXACT FIRST when correctness matters (tests, small tables, audits).
  • FETCH APPROX FIRST when you want the index's speed.
  • If you build HNSW indexes, check the Vector Pool first, or you'll meet ORA-51962.

The full, step-by-step version is in the guide

Oracle AI Database 26ai Vector Search for app developers

Read the guide →

One email when a new tested guide, template or APEX release note lands — English or Arabic. No spam; unsubscribe anytime.