pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: Masrt200 (@Masrt200) <noreply+Masrt200@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #784: HNSW Index Cost Computation
Date: Mon, 24 Feb 2025 06:38:42 +0000
Message-ID: <gh-pgvector-pgvector-784@github.com> (raw)

Hi,

I have two datasets one with 128 dimensions and another with 768 dimensions, both have the same number of vectors (10 million). Both indexes are created with the same construction parameters.

When I run a filter query (id < 10000) on the `id` colum, it does seq-scan for the 768 case but uses the hnsw index for the 128 dimension case. `id` is sorted in ascending order.  iterative_scan is off.

I looked at the cost estimation function and it uses `m` and `ef_search` to compute the cost. I tried setting `ef_search` to the maximum value and it still uses the index for the 128-dim case. The 768-dim case starts using seq-scan for a low value of `ef_search`.

Since there are only 10000 vectors, seq-scan gives better performance in this, and I want the planner to behave that way by default. 

Is the size of the vectors, the reason for this behaviour? Also are there any plans to use the iterative_scan parameters in the cost calculation? Any insights would be helpful.

view thread (3+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-784@github.com>
Permalink:  ../gh-pgvector-pgvector-784@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox