pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: knizhnik (@knizhnik) <noreply+knizhnik@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] PR #282: Hnsw iterator
Date: Thu, 28 Sep 2023 15:56:00 +0000
Message-ID: <gh-pgvector-pgvector-282-c1739604563@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-282@github.com>
References: <gh-pgvector-pgvector-282@github.com>

> Are there any tests/benchmarks comparing this updated method to the older method? How does this impact performance/recall?

Results on OpenAI dataset (1M embeddings with 1636 dimension).
The query is `SELECT _id, openai_vector <-> ARRAY[...]::vector as dist from documents order by dist LIMIT 10;`

```
postgres=# set hnsw.enable_iterator = on;
SET
Time: 0.136 ms
postgres=#  \i ~/ann-benchmarks/openai-pgvector.sql
                      _id                       |        dist        
------------------------------------------------+--------------------
 <dbpedia:Paris>                                | 0.5149979680215692
 <dbpedia:Economy_of_Paris>                     | 0.5322160352313228
 <dbpedia:List_of_tourist_attractions_in_Paris> | 0.5556925144520639
 <dbpedia:Capitale-Nationale>                   |  0.560634247353793
 <dbpedia:Besançon>                            | 0.5639481182838457
 <dbpedia:Captal>                               | 0.5744128256080486
 <dbpedia:Palais_de_Justice,_Paris>             | 0.5744524110550726
 <dbpedia:Laon>                                 | 0.5754102943098868
 <dbpedia:Hôtel_de_Ville,_Paris>               | 0.5779674934070351
 <dbpedia:Timeline_of_Paris>                    | 0.5780753294768416
(10 rows)

Time: 4.177 ms
postgres=# set hnsw.enable_iterator = off;
SET
Time: 0.110 ms
postgres=#  \i ~/ann-benchmarks/openai-pgvector.sql
                      _id                       |        dist        
------------------------------------------------+--------------------
 <dbpedia:Paris>                                | 0.5149979680215692
 <dbpedia:Economy_of_Paris>                     | 0.5322160352313228
 <dbpedia:List_of_tourist_attractions_in_Paris> | 0.5556925144520639
 <dbpedia:Capitale-Nationale>                   |  0.560634247353793
 <dbpedia:Besançon>                            | 0.5639481182838457
 <dbpedia:Captal>                               | 0.5744128256080486
 <dbpedia:Palais_de_Justice,_Paris>             | 0.5744524110550726
 <dbpedia:Laon>                                 | 0.5754102943098868
 <dbpedia:Hôtel_de_Ville,_Paris>               | 0.5779674934070351
 <dbpedia:Timeline_of_Paris>                    | 0.5780753294768416
(10 rows)

Time: 3.545 ms
```


view thread (33+ messages)  latest in thread

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