pg.ddx.io pgvector/pgvector GitHub issues and pull requests
help / color / mirror / Atom feed[pgvector/pgvector] issue #751: No Results with HNSW and Filtering
8+ messages / 2 participants
[nested] [flat]
* [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-06 21:29 "svim-ig (@svim-ig)" <noreply+svim-ig@github.com>
0 siblings, 0 replies; 8+ messages in thread
From: svim-ig (@svim-ig) @ 2025-01-06 21:29 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
I am having two tables where table1 created with hnsw indexing and table2 created with ivf indexing (Num of records:1M)
Not getting results (getting empty records) with HNSW and filtering as per query below:
cursor.execute("set hnsw.ef_search = 1000;")
cursor.execute("set hnsw.iterative_scan = 'relaxed_order';")
cursor.execute("set hnsw.max_scan_tuples = 20000;")
cursor.execute("set hnsw.scan_mem_multiplier = 2;")
cur.execute("""
SELECT product_description
FROM table2
WHERE channel= 'ONLINE' and price >100 and price<500
ORDER BY product_embeddings <-> %s
LIMIT 10
""", (query_embedding,)).......whereas with IVF i am getting results by simply setting cursor.execute("set ivfflat.probes = 31;") on table 2...how to get results with HNSW too
I created index on channel and price columns too using btree indexing
^ permalink raw [nested|flat] 8+ messages in thread
* Re: [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-07 01:49 ` "ankane (@ankane)" <noreply+ankane@github.com>
6 siblings, 0 replies; 8+ messages in thread
From: ankane (@ankane) @ 2025-01-07 01:49 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Hi @svim-ig, what’s the output of EXPLAIN ANALYZE?
^ permalink raw [nested|flat] 8+ messages in thread
* Re: [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-07 02:28 ` "svim-ig (@svim-ig)" <noreply+svim-ig@github.com>
6 siblings, 0 replies; 8+ messages in thread
From: svim-ig (@svim-ig) @ 2025-01-07 02:28 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
**Output of Explain Analyze is as follows:**
('Limit (cost=280.40..340.95 rows=10 width=472) (actual time=31.616..31.617 rows=0 loops=1)',)
(' -> Index Scan using prod_embedngs_1m_idx_hnsw on fashion_1m_data_embedng_2 (cost=280.40..184076.29 rows=30355 width=472) (actual time=31.614..31.615 rows=0 loops=1)',)
(" Order By: (product_embeddings <-> '[-0.05002027,-0.20752709,-0.059010178,0.014399445,0.085292175,..........0.1900907,-0.05728554]'::vector)",)
(" Filter: ((price > '100'::numeric) AND (price < '500'::numeric) AND (channel_code = 'ONL'::text))",)
(' Rows Removed by Filter: 1185',)
('Planning Time: 0.130 ms',)
('Execution Time: 31.648 ms',)
^ permalink raw [nested|flat] 8+ messages in thread
* Re: [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-07 08:09 ` "ankane (@ankane)" <noreply+ankane@github.com>
6 siblings, 0 replies; 8+ messages in thread
From: ankane (@ankane) @ 2025-01-07 08:09 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
@ankane closed this.
^ permalink raw [nested|flat] 8+ messages in thread
* Re: [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-07 08:09 ` "ankane (@ankane)" <noreply+ankane@github.com>
6 siblings, 0 replies; 8+ messages in thread
From: ankane (@ankane) @ 2025-01-07 08:09 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
It looks like iterative scanning isn't enabled (based on `Rows Removed by Filter`).
^ permalink raw [nested|flat] 8+ messages in thread
* Re: [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-07 08:26 ` "svim-ig (@svim-ig)" <noreply+svim-ig@github.com>
6 siblings, 0 replies; 8+ messages in thread
From: svim-ig (@svim-ig) @ 2025-01-07 08:26 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
How to enable iterative scanning ?
^ permalink raw [nested|flat] 8+ messages in thread
* Re: [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-07 08:28 ` "ankane (@ankane)" <noreply+ankane@github.com>
6 siblings, 0 replies; 8+ messages in thread
From: ankane (@ankane) @ 2025-01-07 08:28 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
It's in the docs. Make sure it's set in the same session that's running the query, and please use other resources for additional help.
^ permalink raw [nested|flat] 8+ messages in thread
* Re: [pgvector/pgvector] issue #751: No Results with HNSW and Filtering
@ 2025-01-07 08:30 ` "svim-ig (@svim-ig)" <noreply+svim-ig@github.com>
6 siblings, 0 replies; 8+ messages in thread
From: svim-ig (@svim-ig) @ 2025-01-07 08:30 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Ok Thank You...I remember that : set hnsw.iterative_scan = 'relaxed_order' will enable interative_scanning...will check for further
^ permalink raw [nested|flat] 8+ messages in thread
end of thread, other threads:[~2025-01-07 08:30 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-06 21:29 [pgvector/pgvector] issue #751: No Results with HNSW and Filtering "svim-ig (@svim-ig)" <noreply+svim-ig@github.com>
2025-01-07 01:49 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-01-07 02:28 ` "svim-ig (@svim-ig)" <noreply+svim-ig@github.com>
2025-01-07 08:09 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-01-07 08:09 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-01-07 08:26 ` "svim-ig (@svim-ig)" <noreply+svim-ig@github.com>
2025-01-07 08:28 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-01-07 08:30 ` "svim-ig (@svim-ig)" <noreply+svim-ig@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