1 Answer
- Newest
- Most votes
- Most comments
0
Hi there.
I'm reading the documentation and it seems this is set along with your code. It is a query option.
By default, pgvector performs exact nearest neighbor search, which provides perfect recall. You can add an index to use approximate nearest neighbor search, which trades some recall for performance. Unlike typical indexes, you will see different results for queries after adding an approximate index. Three keys to achieving good recall are:
- Create the index after the table has some data
- Choose an appropriate number of lists - a good place to start is rows / 1000 for up to 1M rows and sqrt(rows) for over 1M rows
- When querying, specify an appropriate number of probes (higher is better for recall, lower is better for speed) - a good place to start is sqrt(lists)
Add an index for each distance function you want to use.
This way, in your code you would just execute something like
BEGIN;
SET LOCAL ivfflat.probes = 10;
SELECT <your query>
COMMIT;
This doesn't look like a setting at the instance/database level but you set it on each query.
I hope this helps.
Relevant content
- asked 2 months ago
- Accepted Answerasked 2 years ago
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 8 months ago