pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] issue #853: vector query search results are different between multiple pgvector instances with same setup
3+ messages / 2 participants
[nested] [flat]

* [pgvector/pgvector] issue #853: vector query search results are different between multiple pgvector instances with same setup
@ 2025-06-06 08:33  "soukathit (@soukathit)" <noreply+soukathit@github.com>
  0 siblings, 0 replies; 3+ messages in thread

From: soukathit (@soukathit) @ 2025-06-06 08:33 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi Team,

We are using PGVector for building a RAG application for our internal customers knowledge base datasets. We are using Llamaindex pipeline to extract, enrich with metadata and load to PGVector database and having HNSW index built for these datasets with cosine similarity (m=16 and ef_construction=32)

we loaded the data to dev instance and ran a test and we noticed that the retrieval data from the database seems fine. We have to replicate the data to 2 other instances like qa & stage instance. We used standard replication feature supported by postgres (pub/sub model) to move data from dev to qa. When we run the same test in both dev/qa , we get different search results with the same embedding queries. Why this issue can happen?

we have the below options enabled in both dev/qa instance.

enable_seqscan = OFF;
We disabled this option as the queries were leveraging index scan rather than using the HNSW index.

hnsw.iterative_scan = relaxed_order
we set the iterative_scan to relaxed order.

hnsw.max_scan_tuples = 20000;
Set as per the suggestion
https://github.com/pgvector/pgvector?tab=readme-ov-file#tuning

hnsw.scan_mem_multiplier = 2;
Set as per the suggestion
https://github.com/pgvector/pgvector?tab=readme-ov-file#tuning

 hnsw.ef_search = 32;
we are retrieving top 32 nearest neighbours.

please let us know why this issue can happen across different instances.

^ permalink  raw  [nested|flat] 3+ messages in thread

* Re: [pgvector/pgvector] issue #853: vector query search results are different between multiple pgvector instances with same setup
@ 2025-06-06 20:25  "ankane (@ankane)" <noreply+ankane@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: ankane (@ankane) @ 2025-06-06 20:25 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @soukathit, indexes should be the same with [streaming (WAL-based) replication](https://www.postgresql.org/docs/current/warm-standby.html#STREAMING-REPLICATION), but they won't be when using another type of replication like logical (the HNSW algorithm has randomness).

^ permalink  raw  [nested|flat] 3+ messages in thread

* Re: [pgvector/pgvector] issue #853: vector query search results are different between multiple pgvector instances with same setup
@ 2025-06-06 20:25  "ankane (@ankane)" <noreply+ankane@github.com>
  1 sibling, 0 replies; 3+ messages in thread

From: ankane (@ankane) @ 2025-06-06 20:25 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

^ permalink  raw  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-06-06 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-06-06 08:33 [pgvector/pgvector] issue #853: vector query search results are different between multiple pgvector instances with same setup "soukathit (@soukathit)" <noreply+soukathit@github.com>
2025-06-06 20:25 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-06-06 20:25 ` "ankane (@ankane)" <noreply+ankane@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