You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] HNSW index omits rows inserted after index creation #25610
After an HNSW index is created, MatrixOne accepts a subsequent INSERT into the indexed table but the vector KNN query does not include the new row. The index becomes stale while the base table remains writable, so a query can return fewer rows than the table contains.
Reproduction
At commit 7821d21c723372e45a8f65da3bbb896a157b1036, through proxy 6001:
CREATEDATABASEhnsw_repro;
USE hnsw_repro;
SET experimental_hnsw_index =1;
CREATETABLEt(a BIGINTPRIMARY KEY, v VECF32(3));
INSERT INTO t VALUES
(1,'[1,1,1]'),(2,'[2,2,2]'),(3,'[3,3,3]'),(4,'[8,8,8]');
CREATEINDEXidx USING HNSW ON t(v)
OP_TYPE 'vector_l2_ops' M=4 EF_CONSTRUCTION=64 EF_SEARCH=32;
INSERT INTO t VALUES (5,'[1.01,1.01,1.01]');
SELECT a, L2_DISTANCE(v,'[1,1,1]') AS d
FROM t ORDER BY L2_DISTANCE(v,'[1,1,1]') ASCLIMIT5;
SELECTCOUNT(*) FROM t;
Observed KNN output contains only ids 1,2,3,4, while COUNT(*) is 5; the newly inserted nearest row 5 is absent. The same HNSW table accepts UPDATE/DELETE as well, so this is silent index/data divergence rather than a rejected unsupported write.
Expected
Either keep the HNSW index synchronized for accepted INSERT/UPDATE/DELETE operations, or reject writes to an HNSW-indexed column/table with a clear error and documented rebuild workflow. KNN results must not silently omit committed rows.
Revalidated against commit 7821d21c723372e45a8f65da3bbb896a157b1036. HNSW is intentionally AlwaysAsync through ISCP CDC. The inserted row is absent immediately after INSERT, but the same KNN query includes it after the CDC catches up (about 5 seconds in the local CN/DN/logservice/proxy cluster). The repository's vector_hnsw_async.sql and vector_hnsw_modern_dml.sql also treat HNSW DML/index maintenance as asynchronous. This is an expected consistency window rather than a permanent omission, so closing this issue; the async visibility contract should still be made clearer in the user-facing docs.
Activity
Ariznawlll commentedon Jul 11, 2026
Revalidated against commit
7821d21c723372e45a8f65da3bbb896a157b1036. HNSW is intentionallyAlwaysAsyncthrough ISCP CDC. The inserted row is absent immediately after INSERT, but the same KNN query includes it after the CDC catches up (about 5 seconds in the local CN/DN/logservice/proxy cluster). The repository'svector_hnsw_async.sqlandvector_hnsw_modern_dml.sqlalso treat HNSW DML/index maintenance as asynchronous. This is an expected consistency window rather than a permanent omission, so closing this issue; the async visibility contract should still be made clearer in the user-facing docs.