pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #909: Optimising Insert+Index creation time
Date: Fri, 10 Oct 2025 13:39:56 +0000
Message-ID: <gh-pgvector-pgvector-909-c3390190170@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-909@github.com>
References: <gh-pgvector-pgvector-909@github.com>

@aasneh-prasad-glean I suggest watching [this video](youtube.com/watch?v=L8fQqVwTT3Y&ab_channel=AWSEvents) (or any one of the ones [listed here](https://jkatz05.com/talks/) for guidance on this, as this covers best practices, including parameter tuning. (Which reminds me, I have some newer versions of the talk to publish)

tl;dr:
* If you're bulk loading, first load the vectors, then build the index
* Use `COPY ... WITH (FORMAT BINARY)`  when loading the vectors, this will speed things up
* With the index, start with the default parameters (m=16, ef_construction=64) and only adjust if you're not getting your target search relevancy
* Adjust `maintenance_work_mem` to try to fit your vector set, with some overhead for the HNSW index. I use a factor of 1.3. So for the above, assuming no quantization: `(1.3 * 1500000 * (8 + 4 * 128)) / 1024**3` = ~1GB of `maintenance_work_mem`. A higher `m` will require more.
* Because you only have 2 vCPU, you should use more than two parallel workers for the build.


view thread (4+ messages)  latest in thread

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