Skip to content

bug: prefilter cannot see multiple row versions #335

@silver-ymz

Description

@silver-ymz

Reproduce Case:

CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3), visible boolean default true);
INSERT INTO items (embedding) SELECT ARRAY[random(), random(), random()]::real[] FROM generate_series(1, 1000);
CREATE INDEX ON items USING vchordrq (embedding vector_l2_ops);
SET vchordrq.prefilter = on;
SET enable_seqscan = off;

SELECT * FROM items WHERE visible = true ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
-- if the nearest id = 10
UPDATE items SET visible = false WHERE id = 10;
UPDATE items SET visible = true WHERE id = 10;

SELECT * FROM items WHERE visible = true ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
-- now we can't get the tuple which id is 10

https://github.com/tensorchord/VectorChord/blob/54dc7b9fd36d73171ff87f1cbf6022a6b1865025/src/index/fetcher.rs#L97-L113
When fetching tuple from heap, we should use index_fetch_tuple rather than tuple_fetch_row_version. The latter does not check MVCC

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions