From: ankane (@ankane) <noreply+ankane@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #721: HNSW index bypassed when LIMIT or filter selectivity exceeds threshold
Date: Wed, 04 Dec 2024 18:05:33 +0000
Message-ID: <gh-pgvector-pgvector-721-c2518172202@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-721@github.com>
References: <gh-pgvector-pgvector-721@github.com>
Hi @rsomani95, scanning more a vector index will be more expensive (which can happen with a higher limit or filters with a lower selectivity), and it looks like that's pushing it over the cost of other index scans. If you haven't already, try setting `random_page_cost` to 1.1. You can also use the [pg_hint_plan extension](https://github.com/ossc-db/pg_hint_plan) to better control if an index is used.