Skip to main content
Applies to: Embedded ❌, Enterprise ✅
Distance functions can evaluate arrays per row. Some deployment versions also recognize ORDER BY distance(vector, query_vector) LIMIT k over a table scan and plan it as vector search, with indexed or flat search as appropriate. Where available, exact_distance evaluates distance without that rewrite. Confirm the functions supported by your deployment and inspect SQL EXPLAIN; the function name alone does not guarantee an index-backed plan. See SQL vector search.
A third, optional argument is a comma-separated options string, and only distance and exact_distance accept one; cosine_distance and inner_product are plain two-argument functions. metric selects l2 (default, alias euclidean), cosine, or dot. nprobes and use_index only affect distance, since it’s the only one of the two that the index-search rewrite applies to in the first place — exact_distance is never rewritten into an index search, so passing it use_index/nprobes does nothing; use a plain distance call with use_index=false to force a flat scan instead:

What to read next

SQL vector search

Server-version requirements and the supported ORDER BY query forms.

EXPLAIN

Confirm whether a query planned as an index-backed vector search.