From: ankane (@ankane) <noreply+ankane@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #822: HNSW index creation is stuck on dozens millions entries
Date: Mon, 14 Apr 2025 21:18:38 +0000
Message-ID: <gh-pgvector-pgvector-822-c2803049340@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-822@github.com>
References: <gh-pgvector-pgvector-822@github.com>
In this case, pgvector reported the specific issue and how to address it.
```text
NOTICE: hnsw graph no longer fits into maintenance_work_mem after 570905 tuples
DETAIL: Building will take significantly more time.
HINT: Increase maintenance_work_mem to speed up builds.
```
In addition to looking at indexing progress, you can also check `pg_stat_activity` to see how many workers are being used.
Sentry has a [good write-up](https://blog.sentry.io/how-sentry-decreased-issue-noise-with-ai/) on their approach.
One trick to speed up vacuuming is [mentioned here](https://github.com/pgvector/pgvector?tab=readme-ov-file#vacuuming). You can also use partitioning to create smaller indexes that be vacuumed independently.