pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
[pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index
6+ messages / 5 participants
[nested] [flat]

* [pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index
@ 2025-01-04 01:49 "sungkim11 (@sungkim11)" <noreply+sungkim11@github.com>
  0 siblings, 0 replies; 6+ messages in thread

From: sungkim11 (@sungkim11) @ 2025-01-04 01:49 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

HNSW Index

Current: sparsevec - up to 1,000 non-zero elements (added in 0.7.0)
Enhancement Request: sparsevec - up to 1,200 non-zero elements

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

* Re: [pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index
@ 2025-01-04 01:51 ` "jkatz (@jkatz)" <noreply+jkatz@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: jkatz (@jkatz) @ 2025-01-04 01:51 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

What is driving the requirement for 1,200 nonzero elements? What are other alternatives you can consider (e.g. can you split up the sparse vector into two different columns?)

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

* Re: [pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index
@ 2025-01-04 01:59 ` "sungkim11 (@sungkim11)" <noreply+sungkim11@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: sungkim11 (@sungkim11) @ 2025-01-04 01:59 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

When I am creating sparse vector using SPLADE, I am seeing few instances of records with 1,100 non-zero elements. Given that SPLADE has 30,522 dimensions, having 1,100 non-zero elements can be classified as sparse. Only other option is truncate non-zero elements.

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

* Re: [pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index
@ 2025-03-18 16:25 ` "amelboc (@amelboc)" <noreply+amelboc@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: amelboc (@amelboc) @ 2025-03-18 16:25 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

I have an issue where I want to create sparsevecs in my postgres database but I get an issue when the index of the elements in my sparsevec are larger than the dimensions. Example: {1:1, 3:2, 5:3, 102:2}/100 the index 102 is out of bounds whilst {1:1, 3:2, 5:3, 99:2}/100 is fine. Why can the index not be larger than the dimension size when the amount of elements in the sparsevec are still restricted to dimensions size? If the case is that you can have up to 1000 non-zero elements and 16000 zero elements in a sparsevec, then the indexing problem makes little sense to me. 

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

* Re: [pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index
@ 2025-03-18 16:53 ` "ankane (@ankane)" <noreply+ankane@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: ankane (@ankane) @ 2025-03-18 16:53 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

@amelboc It sounds like you're trying to create an invalid vector. If there's a value at index 102, the vector can't have less than 102 dimensions.

For instance, `{3:99}/3` represents the vector `[0,0,99]`. There are only 3 dimensions to set, so `{4:99}/3` is not valid. Please use other resources for additional help with this.

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

* Re: [pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index
@ 2026-04-20 17:14 ` "backroot (@backroot)" <noreply+backroot@github.com>
  4 siblings, 0 replies; 6+ messages in thread

From: backroot (@backroot) @ 2026-04-20 17:14 UTC (permalink / raw)
  To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>

Hi,

I’m interested in working on this issue and had a quick question before starting.

Is the current limit of 1,000 non-zero elements in `sparsevec` primarily driven by storage constraints (e.g., fitting within a single page / varlena size), performance considerations, or something specific to HNSW indexing?

If we increase the limit to 1,200, are there known concerns around memory layout, TOAST usage, or index performance that should be taken into account?

I’d be happy to prototype a change and include tests/benchmarks, but wanted to confirm the intended constraints and any design considerations first.

Thanks!


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


end of thread, other threads:[~2026-04-20 17:14 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-04 01:49 [pgvector/pgvector] issue #749: Enhancement: Increase 1,000 non-zero elements limit to 1,200 for sparsevec when creating HNSW index "sungkim11 (@sungkim11)" <noreply+sungkim11@github.com>
2025-01-04 01:51 ` "jkatz (@jkatz)" <noreply+jkatz@github.com>
2025-01-04 01:59 ` "sungkim11 (@sungkim11)" <noreply+sungkim11@github.com>
2025-03-18 16:25 ` "amelboc (@amelboc)" <noreply+amelboc@github.com>
2025-03-18 16:53 ` "ankane (@ankane)" <noreply+ankane@github.com>
2026-04-20 17:14 ` "backroot (@backroot)" <noreply+backroot@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