From: rmincling (@rmincling) <noreply+rmincling@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #675: Question Setting ef_search to different values does not affect number of results retrieved (Django 4.2 + PGVector + HNSW index)
Date: Mon, 16 Sep 2024 15:52:35 +0000
Message-ID: <gh-pgvector-pgvector-675-c2353302201@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-675@github.com>
References: <gh-pgvector-pgvector-675@github.com>
ok, so here is an interesting update, regardless of what LIMIT I used, the HNSW index was NOT being used (confirmed when using EXPLAIN ANALYZE. It was using a sequential scan.
So I tried this:
```
cursor.execute("SET LOCAL enable_seqscan TO off;")
```
Resulting in the HNSW being used.
So now, when i change the value of ef_search the amount of results changes accordingly.
```
cursor.execute("SET LOCAL hnsw.ef_search = 100")
```
My next question is, I expect this vector table to have potentially 100k rows. So how do I decide if I should used HNSW index or not?