pg.ddx.io pgvector/pgvector GitHub issues and pull requestshelp / color / mirror / Atom feed
[pgvector/pgvector] issue #820: JOIN with distance limit doesn't use index? 4+ messages / 2 participants [nested] [flat]
* [pgvector/pgvector] issue #820: JOIN with distance limit doesn't use index? @ 2025-04-12 15:22 "margaret-pan (@margaret-pan)" <noreply+margaret-pan@github.com> 0 siblings, 0 replies; 4+ messages in thread From: margaret-pan (@margaret-pan) @ 2025-04-12 15:22 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> I have two tables, let's call them `big` and `small`, each of which has a name column `big_id`, `small_id` (string) and a `coord` column (vector). I've added a HNSW index on the `coord` column to `big`, and I'd like to find the elements of `big` whose `coord`s are less than an l2-distance `0.002` away from the `coord` of each element of `small`. I'm trying to do this with a JOIN: `SELECT small_id, array_agg(big_id) AS array_agg FROM small JOIN big ON l2_distance(big.coord, small.coord) < 0.002 GROUP BY small_id;` EXPLAIN ANALYZE suggests that this isn't using the index on `big`. Is there a workaround to make it use the index? ^ permalink raw [nested|flat] 4+ messages in thread
* Re: [pgvector/pgvector] issue #820: JOIN with distance limit doesn't use index? @ 2025-04-12 21:59 "ankane (@ankane)" <noreply+ankane@github.com> 2 siblings, 0 replies; 4+ messages in thread From: ankane (@ankane) @ 2025-04-12 21:59 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Hi @margaret-pan, check out #59 for how to search an index for multiple vectors. ^ permalink raw [nested|flat] 4+ messages in thread
* Re: [pgvector/pgvector] issue #820: JOIN with distance limit doesn't use index? @ 2025-04-12 21:59 "ankane (@ankane)" <noreply+ankane@github.com> 2 siblings, 0 replies; 4+ messages in thread From: ankane (@ankane) @ 2025-04-12 21:59 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] issue #820: JOIN with distance limit doesn't use index? @ 2025-04-13 14:21 "margaret-pan (@margaret-pan)" <noreply+margaret-pan@github.com> 2 siblings, 0 replies; 4+ messages in thread From: margaret-pan (@margaret-pan) @ 2025-04-13 14:21 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> @ankane Thanks for the response ^ permalink raw [nested|flat] 4+ messages in thread
end of thread, other threads:[~2025-04-13 14:21 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-04-12 15:22 [pgvector/pgvector] issue #820: JOIN with distance limit doesn't use index? "margaret-pan (@margaret-pan)" <noreply+margaret-pan@github.com> 2025-04-12 21:59 ` "ankane (@ankane)" <noreply+ankane@github.com> 2025-04-12 21:59 ` "ankane (@ankane)" <noreply+ankane@github.com> 2025-04-13 14:21 ` "margaret-pan (@margaret-pan)" <noreply+margaret-pan@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