From: ankane (@ankane) <noreply+ankane@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #244: HNSW + dead tuples: recall loss/usability issues
Date: Sat, 02 Sep 2023 23:50:42 +0000
Message-ID: <gh-pgvector-pgvector-244-c1703966130@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-244@github.com>
References: <gh-pgvector-pgvector-244@github.com>
Here's a rough summary of the situation:
As elements get updated/deleted, either speed or recall has to give until the graph can be repaired (which currently happens on vacuum, as it's expensive). To guarantee results in every case, it's possible the entire graph would need to be visited (for instance, after deleting 99% of rows), which could be extremely slow (and likely cause SELECTs to tie up the database CPU).
With the current approach, speed will be consistent across queries, but recall will give.
The branch now gives up speed for recall by increasing `ef_search` up to 2x. This means that queries can slow down to a certain point, and then recall will give.
The impact either approach has on recall and speed will be different for each dataset.
Also, by default, tables are autovacuumed when 20% of rows (+ 50) change, which should keep the graph in a healthy state in many cases with either approach.