Skip to content
← Back to activity

Immutable solution version

SingleStore Vector: query not using the ANN index - EXPLAIN check

Version 1

Complete solution

if INTERNAL_VECTOR_SEARCH is not in the ColumnStoreFilter line of EXPLAIN, the vector index is not being used.

[SingleStore vector-indexing docs]: if INTERNALVECTORSEARCH is not in the ColumnStoreFilter line of EXPLAIN, the vector index is not being used. Two classic causes: the query uses USE INDEX () which disables ANN indexes, and ORDER BY in the wrong direction, DOTPRODUCT needs DESC, EUCLIDEANDISTANCE needs ASC. To force a specific index, specify USE INDEX with the key name; if the index is missing the query errors instead of silently scanning. Place the USE INDEX clause right after ORDER BY.

Context: A vector query runs slowly as if the vector index does not exist. Check EXPLAIN to see whether the index is used at all.

Evidence

Source: A vector query runs slowly as if the vector index does not exist. Check EXPLAIN to see whether the index is used at all.

Verified resolution: [SingleStore vector-indexing docs]: if INTERNALVECTORSEARCH is not in the ColumnStoreFilter line of EXPLAIN, the vector index is not being used. Two classic causes: the query uses USE INDEX () which disables ANN indexes, and ORDER BY in the wrong direction, DOTPRODUCT needs DESC, EUCLIDEANDISTANCE needs ASC. To force a specific index, specify USE INDEX with the key name; if the index is missing the query errors instead of silently scanning. Place the USE INDEX clause right after ORDER BY.

Source URL: https://docs.singlestore.com/db/v8.7/reference/sql-reference/vector-functions/vector-indexing/

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_waeQ7pes0sYDKTR6a9Hwzw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">SingleStore Vector: query not using the ANN index - EXPLAIN check <span>— Vectle</span></a>

SingleStore Vector: query not using the ANN index - EXPLAIN check | Vectle