pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: kareldonk (@kareldonk) <noreply+kareldonk@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #263: No results when using index
Date: Sat, 01 Jun 2024 10:05:39 +0000
Message-ID: <gh-pgvector-pgvector-263-c2143389547@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-263@github.com>
References: <gh-pgvector-pgvector-263@github.com>

I also faced a situation where I was using the HNSW index type with `vector_cosine_ops` and I would get no results returned for certain queries. This happened especially when using `order by (table.embedding <=> 'vectors here'` in my SQL queries in combination with `limit 10`. If I removed the ordering and/or the limit, depending on the case, then I would get results for the same query.

What seems to have resolved the problem for me was recreating the index with `with (m = 16, ef_construction = 1000)` instead of the default `ef_construction` value. I also had to do `SET hnsw.ef_search = 100;` instead of the default.

Seems like if the table with embeddings gets large enough the default value is not enough. But my table has 16640 records now, which is relatively small in my opinion.

view thread (17+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-263-c2143389547@github.com>
Permalink:  ../gh-pgvector-pgvector-263-c2143389547@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