pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] PR #809: docs: Add FAQ about pgvector feasibility for bulk distance calculations
4+ messages / 2 participants
[nested] [flat]

* [pgvector/pgvector] PR #809: docs: Add FAQ about pgvector feasibility for bulk distance calculations
@ 2025-03-26 23:56  "frapercan (@frapercan)" <noreply+frapercan@github.com>
  0 siblings, 0 replies; 4+ messages in thread

From: frapercan (@frapercan) @ 2025-03-26 23:56 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

This PR adds a frequently asked question and answer detailing why row-oriented databases such as Postgres (with pgvector) may not be optimal for massive distance computations.

inline patch 1: README.md (+4/-0 lines) download inline-1.patchdiff --git a/README.md b/README.md index 1ee996b94..af817528d 100644 --- a/README.md +++ b/README.md @@ -881,6 +881,10 @@ No, but like other index types, you’ll likely see better performance if they d SELECT pg_size_pretty(pg_relation_size('index_name')); ``` +#### Is it feasible to use pgvector for bulk distance calculations? + +row-oriented databases like Postgres aren’t optimized for massive distance computations. For large-scale vector operations (e.g., millions of vectors), it’s recommended to use specialized libraries that store vectors in contiguous memory and support matrix operations, as this delivers much higher performance than repeatedly calculating distances within SQL. + ## Troubleshooting #### Why isn’t a query using an index?
^ permalink raw [nested|flat] 4+ messages in thread

* Re: [pgvector/pgvector] PR #809: docs: Add FAQ about pgvector feasibility for bulk distance calculations
@ 2025-03-27 00:49  "ankane (@ankane)" <noreply+ankane@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: ankane (@ankane) @ 2025-03-27 00:49 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @frapercan, thanks for the PR, but it's not something I'd like to include. pgvector can handle millions of distance calculations just fine, and in most cases, users can use indexing to reduce them.

https://github.com/pgvector/pgvector/issues/808#issuecomment-2755983913 applies to when billions or trillions of distance calculations are needed, which isn't the case in most situations.

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

* Re: [pgvector/pgvector] PR #809: docs: Add FAQ about pgvector feasibility for bulk distance calculations
@ 2025-03-27 00:49  "ankane (@ankane)" <noreply+ankane@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: ankane (@ankane) @ 2025-03-27 00:49 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

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

* Re: [pgvector/pgvector] PR #809: docs: Add FAQ about pgvector feasibility for bulk distance calculations
@ 2025-03-27 01:34  "frapercan (@frapercan)" <noreply+frapercan@github.com>
  2 siblings, 0 replies; 4+ messages in thread

From: frapercan (@frapercan) @ 2025-03-27 01:34 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Have you ever compared performance using for example sklearn compute_distances method vs this method?

Even if you mount the database in shm, with optimized postgres configuration in a HPC, there is no comparison.

I think that thousands vs thousands are already a problem. 

Anyways, thanks!!



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


end of thread, other threads:[~2025-03-27 01:34 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-26 23:56 [pgvector/pgvector] PR #809: docs: Add FAQ about pgvector feasibility for bulk distance calculations "frapercan (@frapercan)" <noreply+frapercan@github.com>
2025-03-27 00:49 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-03-27 00:49 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-03-27 01:34 ` "frapercan (@frapercan)" <noreply+frapercan@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