pg.ddx.io pgvector/pgvector GitHub issues and pull requests
help / color / mirror / Atom feed[pgvector/pgvector] issue #731: Building of hnsw sparse index is very slow
3+ messages / 2 participants
[nested] [flat]
* [pgvector/pgvector] issue #731: Building of hnsw sparse index is very slow
@ 2024-12-10 06:06 "hzhua (@hzhua)" <noreply+hzhua@github.com>
0 siblings, 0 replies; 3+ messages in thread
From: hzhua (@hzhua) @ 2024-12-10 06:06 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
I'm building both dense index and sparse index for about 5 million records. The dense and sparse vectors are generated from BGE-m3, whose dense embedding has a dimension of 1024, and sparse embedding has a dimension of 250002.
```
SET max_parallel_maintenance_workers = 15;
SET maintenance_work_mem = '32GB';
CREATE INDEX IF NOT EXISTS report_sparse_hnsw_idx
ON vector_report
USING hnsw (sparse_vector sparsevec_cosine_ops)
WITH (m = 48, ef_construction = 96)
CREATE INDEX IF NOT EXISTS report_dense_hnsw_idx
ON vector_report
USING hnsw (dense_vector vector_cosine_ops)
WITH (m = 48, ef_construction = 96)
````
With the same hnsw parameters, the building of dense index is fast (<30 mins), but the sparse index is very slow (the building progress is only 36% in one hour).
^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #731: Building of hnsw sparse index is very slow
@ 2024-12-10 14:35 ` "ankane (@ankane)" <noreply+ankane@github.com>
1 sibling, 0 replies; 3+ messages in thread
From: ankane (@ankane) @ 2024-12-10 14:35 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Hi @hzhua, sparse vector indexes can take longer to build. I'd recommend using the default `m` for faster build times unless you're seeing poor recall with a higher value of `ef_construction`.
^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #731: Building of hnsw sparse index is very slow
@ 2024-12-10 14:35 ` "ankane (@ankane)" <noreply+ankane@github.com>
1 sibling, 0 replies; 3+ messages in thread
From: ankane (@ankane) @ 2024-12-10 14:35 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:[~2024-12-10 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-10 06:06 [pgvector/pgvector] issue #731: Building of hnsw sparse index is very slow "hzhua (@hzhua)" <noreply+hzhua@github.com>
2024-12-10 14:35 ` "ankane (@ankane)" <noreply+ankane@github.com>
2024-12-10 14:35 ` "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