From: arup-chauhan (@arup-chauhan) <noreply+arup-chauhan@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #846: Unexpected use of Index Scan in ANN query without LIMIT or enable_indexscan
Date: Wed, 11 Feb 2026 04:44:37 +0000
Message-ID: <gh-pgvector-pgvector-846-c3882085315@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-846@github.com>
References: <gh-pgvector-pgvector-846@github.com>
Hey @ankane, this looks interesting, and I would like to work on this!
Based on your analysis, it sounds like the planner is preferring the HNSW path because the estimated cost of the external merge sort (for the seq scan) is dominating under the default work_mem.
I am thinking to move forward by doing this:
• Building a minimal reproducible benchmark that varies:
• work_mem
• table size
• vector dimensions
• HNSW parameters (m, ef_construction)
• Capturing planner decisions (EXPLAIN (ANALYZE, BUFFERS)) across these configurations
• Comparing estimated vs actual cost for:
• Seq Scan + Sort
• HNSW Index Scan (no LIMIT)
• Proposing an incremental adjustment to HNSW cost estimation if we consistently see underestimation
Would that be a reasonable first step toward putting a better cost-estimation framework in place?