pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: R3gardless (@R3gardless) <noreply+R3gardless@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #969: Tuning `maintencne_work_mem` to improve  HNSW index build time
Date: Sun, 15 Mar 2026 08:48:04 +0000
Message-ID: <gh-pgvector-pgvector-969@github.com> (raw)

Hi,

I'm currently testing HNSW index build performance while varying `maintenance_work_mem`.

**Environment**
- pgvector 0.8.2 compiled with GCC 14.2.1
- HNSW params : m = 16, ef_construction = 64
- max_parallel_workers = 16
- Table Quantization type : vector

In my environment it is difficult to set `maintenance_work_mem` large enough to fit the entire index in memory due to memory limits and potential OOM risks.

I tested with `maintenance_work_mem` values of 1GB, 10GB, 20GB and 30GB (each run repeated 3 times, values shown are averages of index build time)

<img width="1935" height="886" alt="Image" src="https://github.com/user-attachments/assets/5bd7d361-f34e-4644-97f6-2f7d1b919f74"; />

My understanding is that increasing `maintenance_work_mem` allows more of the index build process to be performed in memory, and if the memory limit is exceeded, the build may spill to disk. (https://github.com/pgvector/pgvector?tab=readme-ov-file#index-build-time)

But for the vector (no quantization) index increasing `maintenance_work_mem` from 1GB to 30GB did not significantly reduce build time. Besides, halfvec and bit quantized indexes showed a clear decrease in build time as `maintenance_work_mem` increased.

Is there still a performance benefit to increasing `maintenance_work_mem` for full-precision vector indexes when it is not large enough to hold the entire index in memory? Or does the benefit only become meaningful once the index fits entirely in memory?

Thank you.

view thread (8+ messages)  latest in thread

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