From: prathier (@prathier) <noreply+prathier@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #719: SELECT WHERE ORDER BY LIMIT no results
Date: Tue, 26 Nov 2024 14:39:27 +0000
Message-ID: <gh-pgvector-pgvector-719@github.com> (raw)
Hello,
This kind of queries no longer works on my database which has more rows than before:
```
SELECT
(v.embedding <#> '[-0.033441752, ...0.012570631]') as distance
FROM vector_table v
LEFT JOIN files f ON f.id = v.file_id
WHERE f.type = 'MYTYPE' AND f.status = 'PROCESSED'
ORDER BY distance
LIMIT 10;
```
If I increase hnsw.ef_search from 100 to 1000 it works but it's slower. And I suppose that 1000 will not be enough when my table will be bigger.
For now I have 7 millions rows but I will reach billion rows soon.
Here is my index:
```
CREATE INDEX IF NOT EXISTS vector_table_embedding_idx
ON vector_table USING hnsw ((embedding::halfvec(512)) halfvec_ip_ops)
WITH (m = 32, ef_construction = 200);
```
7 millions rows looks very small to me, is there a way to have a query correctly working without partioning or sharding my database ?