pg.ddx.io pgvector/pgvector GitHub issues and pull requestshelp / color / mirror / Atom feed
[pgvector/pgvector] issue #877: Slow Inserts with HNSW Index — Is Full Reindexing Occurring? 3+ messages / 3 participants [nested] [flat]
* [pgvector/pgvector] issue #877: Slow Inserts with HNSW Index — Is Full Reindexing Occurring? @ 2025-07-22 14:48 "JWDobken (@JWDobken)" <noreply+JWDobken@github.com> 0 siblings, 0 replies; 3+ messages in thread From: JWDobken (@JWDobken) @ 2025-07-22 14:48 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> Hi and thanks for the great work on pgvector !!! I'm experiencing significantly slower insert performance (~5x) when an HNSW index is present. My current workaround is to temporarily drop the index and recreate it afterward (resulting in system downtime): ```sql -- Drop index before inserts DROP INDEX my_vector_hnsw_idx; -- Recreate it after inserts CREATE INDEX my_vector_hnsw_idx ON public.lovely_information USING hnsw (((subvector(my_vector, 1, 1536))::halfvec(1536)) halfvec_cosine_ops) WITH (m='16', ef_construction='64'); ``` Is there a better way to mitigate this slowdown? Specifically: - What does the HNSW index do when inserting new vectors? - Is it incrementally updating the index or triggering some form of reindexing for each insert? Any advice or configuration tuning tips would be appreciated! Thanks! ^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #877: Slow Inserts with HNSW Index — Is Full Reindexing Occurring? @ 2025-07-22 14:55 ` "jkatz (@jkatz)" <noreply+jkatz@github.com> 1 sibling, 0 replies; 3+ messages in thread From: jkatz (@jkatz) @ 2025-07-22 14:55 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> @JWDobken If you'd like an in-depth look for how this works, here's a [recording from the Seattle PostgreSQL User Group](https://www.youtube.com/watch?v=hF556tnKz2M&ab_channel=SeattlePostgresUsersGroup) that goes into detail. (I just gave a recent presentation on this; reminder to get the slides up). The short answer is that building a HNSW index is an expensive operation. There are techniques to speed this up - preloading the data and the building the index is the fastest way, but if you have to continuously ingest, you'll want to try concurrently inserting or bulk loading. The HNSW method is nice because you can incrementally add to the index with limited impact to the index quality, but the operation to add to the index is expensive. ^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #877: Slow Inserts with HNSW Index — Is Full Reindexing Occurring? @ 2025-07-22 19:57 ` "ankane (@ankane)" <noreply+ankane@github.com> 1 sibling, 0 replies; 3+ messages in thread From: ankane (@ankane) @ 2025-07-22 19:57 UTC (permalink / raw) To: pgvector/pgvector <noreply+pgvector-pgvector@github.com> @ankane closed this. ^ permalink raw [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-07-22 19:57 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-07-22 14:48 [pgvector/pgvector] issue #877: Slow Inserts with HNSW Index — Is Full Reindexing Occurring? "JWDobken (@JWDobken)" <noreply+JWDobken@github.com> 2025-07-22 14:55 ` "jkatz (@jkatz)" <noreply+jkatz@github.com> 2025-07-22 19:57 ` "ankane (@ankane)" <noreply+ankane@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