From: mauriciocirelli (@mauriciocirelli) <noreply+mauriciocirelli@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #259: Understanding HNSW + filtering
Date: Wed, 08 May 2024 15:41:42 +0000
Message-ID: <gh-pgvector-pgvector-259-c2100871643@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-259@github.com>
References: <gh-pgvector-pgvector-259@github.com>
I do not agree with that.
The issue is related to the LIMIT clause. If I remove it, I get all results, as expected.
When I add a LIMIT clause to the outer query, I expect that it would process all the steps of the plan and, in the end, limit the results.
However, on PG15, it is limiting the inner query (HNSW query) too, which brings me only 10 nearest neighbors. Then, it applies the owner/category filter, returning less than 10 results.
Is there anything that I can do on my query or on my database to fix it?