From: fanfuxiaoran (@fanfuxiaoran) <noreply+fanfuxiaoran@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #263: No results when using index
Date: Wed, 13 Sep 2023 13:12:03 +0000
Message-ID: <gh-pgvector-pgvector-263-c1717610451@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-263@github.com>
References: <gh-pgvector-pgvector-263@github.com>
@vincenzon I guess I know the cause, I reproduced it by the following steps
```
create table t5(id int, embedding vector(3));
insert into t5 values(1, '[1,3,5]');
insert into t5 values(2, '[4,5,3]');
insert into t5 values(3, '[7,0,4]');
insert into t5 values(4, '[3,6,9]');
CREATE INDEX ON t5 USING ivfflat (embedding vector_ip_ops) WITH (lists = 4);
set ivfflat.probes=1;
set enable_seqscan=false;
select * from t5 where id = 3 order by embedding <#> '[1,3,5]' limit 2;
```
The above query returns nothing as well.
The ivfflat index searches the cluster '[1,3,5]', but there is no tuple matching the condition 'id=3'.
I think the result is reasonable.