pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] issue #554: Support for multiquery?
6+ messages / 4 participants
[nested] [flat]

* [pgvector/pgvector] issue #554: Support for multiquery?
@ 2024-05-10 09:56  "tamis-laan (@tamis-laan)" <noreply+tamis-laan@github.com>
  0 siblings, 0 replies; 6+ messages in thread

From: tamis-laan (@tamis-laan) @ 2024-05-10 09:56 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

What if I have a batch of vectors I want to query against? I could query for each vector and then combine the results in code but this doesn't sound very efficient. 

I there some kind of batch vector query that is efficient and optimized? 

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

* Re: [pgvector/pgvector] issue #554: Support for multiquery?
@ 2024-05-10 14:06  "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2024-05-10 14:06 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi @tamis-laan, check out #59. 

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

* Re: [pgvector/pgvector] issue #554: Support for multiquery?
@ 2024-05-10 14:06  "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2024-05-10 14:06 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@ankane closed this.

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

* Re: [pgvector/pgvector] issue #554: Support for multiquery?
@ 2024-05-10 14:06  "jkatz (@jkatz)" <noreply+jkatz@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: jkatz (@jkatz) @ 2024-05-10 14:06 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@tamis-laan What are the results you're trying to achieve?

Here is one example of querying for multiple vectors and unioning the results, but unsure what outcome you're trying to get, so it's hard to make further recommendations:

https://github.com/pgvector/pgvector/issues/275#issuecomment-1732374112

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

* Re: [pgvector/pgvector] issue #554: Support for multiquery?
@ 2024-05-10 14:15  "tamis-laan (@tamis-laan)" <noreply+tamis-laan@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: tamis-laan (@tamis-laan) @ 2024-05-10 14:15 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Thnx @ankane, that is exactly the problem I'm trying to solve (@jkatz). However my query would consist of 4000+ vectors I all would like to match. A query like:
``` sql
(SELECT 1 AS query, * FROM items ORDER BY embedding <-> '[1,2,3]' LIMIT 1)
UNION ALL
.
.
.
(SELECT 2 AS query, * FROM items ORDER BY embedding <-> '[4,5,6]' LIMIT 1);
```
would probably become very inefficient. So I was wondering can't we pass in a matrix where each row is a vector to be queried. Something like:
``` sql
SELECT * FROM items ORDER BY embedding <-> '[[1,2,3],...,[4,5,6]]' LIMIT 100;
```
I can imagine this would be way more efficient given that blocks of memory need to be loaded in and out of memory by postgresql in order to do the distance calculation. My database would be ~100GiB in size. My dataset would be much larger, but I'm planning to use multiple databases.

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

* Re: [pgvector/pgvector] issue #554: Support for multiquery?
@ 2024-10-14 13:45  "arslanafzalch (@arslanafzalch)" <noreply+arslanafzalch@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: arslanafzalch (@arslanafzalch) @ 2024-10-14 13:45 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@tamis-laan Did you find any efficient solution for this?

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


end of thread, other threads:[~2024-10-14 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10 09:56 [pgvector/pgvector] issue #554: Support for multiquery? "tamis-laan (@tamis-laan)" <noreply+tamis-laan@github.com>
2024-05-10 14:06 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-05-10 14:06 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-05-10 14:06 ` "jkatz (@jkatz)" <noreply+jkatz@github.com>
2024-05-10 14:15 ` "tamis-laan (@tamis-laan)" <noreply+tamis-laan@github.com>
2024-10-14 13:45 ` "arslanafzalch (@arslanafzalch)" <noreply+arslanafzalch@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