pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: brycechesternewman (@brycechesternewman) <noreply+brycechesternewman@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #949: HNSW partitions and parameters
Date: Wed, 21 Jan 2026 19:02:31 +0000
Message-ID: <gh-pgvector-pgvector-949@github.com> (raw)

Hello,
Let's say I have a 234(bit) binary value for 250 million rows. I want to split those rows into partitions, so that each partition has 10 million 234(bit) rows. I am splitting the data into partitions so when I build the hnsw index for each partition I don't require huge amounts of memory for maintenance_work_mem, work_mem, etc.
What I am not sure of is how should I set the set the HNSW parameters. 

You can see below I am setting the same hnsw parameters for each index. The first `ix_perceptual_hash` index has no overhead(aka nothing is being indexed yet), but the others index the 234(bit) binary values.

```
CREATE INDEX IF NOT EXISTS ix_perceptual_hash ON ONLY Hashes USING hnsw (perceptualHash bit_hamming_ops) WITH (m = 64, ef_construction = 256);

CREATE INDEX CONCURRENTLY imagehashes_p0_perceptualhash_idx ON Hashes_p0 USING hnsw (perceptualHash bit_hamming_ops) WITH (m = 16, ef_construction = 128);
ALTER INDEX ix_perceptual_hash ATTACH PARTITION imagehashes_p0_perceptualhash_idx;

CREATE INDEX CONCURRENTLY imagehashes_p1_perceptualhash_idx ON Hashes_p1 USING hnsw (perceptualHash bit_hamming_ops) WITH (m = 16, ef_construction = 128);
ALTER INDEX ix_perceptual_hash ATTACH PARTITION imagehashes_p1_perceptualhash_idx;
...
```

Once all partitioned indexes are attached to `ix_perceptual_hash` index there will be 350 million 234(bit) indexed rows.
Should the partitioned indexes have the same hnsw parameters values as `ix_perceptual_hash` partition or smaller hnsw parameters values?

Thank you for your time.

view thread (4+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-949@github.com>
Permalink:  ../gh-pgvector-pgvector-949@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