VECTOR INDEX with M=200 returns farthest candidates on 1D monotonic vectors
@JoeJRW ci sta già lavorando.
Dal 1/6/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
alisql version: 8.0.44-alisql-dev
Hi,I understand that ANN indexes may sacrifice accuracy for performance. However, in the following example, setting M=200 causes the query to return vectors near the end of the dataset, which are almost the farthest possible results from the query vector.
This seems different from a typical approximation error. Is this expected behavior, or does it indicate a bug in the vector index implementation?
DROP TABLE IF EXISTS tab_vidx_m3_1d_060;
DROP TABLE IF EXISTS tab_vidx_m6_1d_060;
DROP TABLE IF EXISTS tab_vidx_m200_1d_060;
DROP PROCEDURE IF EXISTS proc_insert_m_1d_060;
CREATE TABLE tab_vidx_m3_1d_060 (
id INT PRIMARY KEY,
v VECTOR(1),
VECTOR INDEX vi(v) DISTANCE=EUCLIDEAN M=3
);
CREATE TABLE tab_vidx_m6_1d_060 (
id INT PRIMARY KEY,
v VECTOR(1),
VECTOR INDEX vi(v) DISTANCE=EUCLIDEAN M=6
);
CREATE TABLE tab_vidx_m200_1d_060 (
id INT PRIMARY KEY,
v VECTOR(1),
VECTOR INDEX vi(v) DISTANCE=EUCLIDEAN M=200
);
DELIMITER //
CREATE PROCEDURE proc_insert_m_1d_060()
BEGIN
DECLARE i INT DEFAULT 1;
WHILE i <= 10000 DO
INSERT INTO tab_vidx_m3_1d_060 VALUES
(i, VEC_FromText(CONCAT('[', i, ']')));
INSERT INTO tab_vidx_m6_1d_060 VALUES
(i, VEC_FromText(CONCAT('[', i, ']')));
INSERT INTO tab_vidx_m200_1d_060 VALUES
(i, VEC_FromText(CONCAT('[', i, ']')));
SET i = i + 1;
END WHILE;
END //
DELIMITER ;
CALL proc_insert_m_1d_060();
DROP PROCEDURE IF EXISTS proc_insert_m_1d_060;
SELECT id
FROM tab_vidx_m3_1d_060 FORCE INDEX(vi)
ORDER BY VEC_DISTANCE(v, VEC_FromText('[1]'))
LIMIT 10;
SELECT id
FROM tab_vidx_m6_1d_060 FORCE INDEX(vi)
ORDER BY VEC_DISTANCE(v, VEC_FromText('[1]'))
LIMIT 10;
SELECT id
FROM tab_vidx_m200_1d_060 FORCE INDEX(vi)
ORDER BY VEC_DISTANCE(v, VEC_FromText('[1]'))
LIMIT 10;
- Lingua principale
- C++
- Stelle
- 6k
- Fork
- 902
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di alibaba/AliSQL
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
Tutte le issue di alibaba/AliSQL
Issue simili
-
prio:medium status:idea type:feat
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
kind/bug needs-sig needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
drogonframework/drogon#2605 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
ArthurSonzogni/FTXUI#1363 ·