pg.ddx.io pgvector/pgvector GitHub issues and pull requests
help / color / mirror / Atom feed[pgvector/pgvector] issue #807: Very Slow HNSW Build for 17M Vectors, 1536 dimensions
3+ messages / 2 participants
[nested] [flat]
* [pgvector/pgvector] issue #807: Very Slow HNSW Build for 17M Vectors, 1536 dimensions
@ 2025-03-26 18:27 "jjaikumar-xyla (@jjaikumar-xyla)" <noreply+jjaikumar-xyla@github.com>
0 siblings, 0 replies; 3+ messages in thread
From: jjaikumar-xyla (@jjaikumar-xyla) @ 2025-03-26 18:27 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
I'm trying to build this index
```
CREATE INDEX CONCURRENTLY "my_hnsw_idx"
ON "my-table"
USING hnsw(vector vector_cosine_ops)
WITH (m = 32, ef_construction = 128);
```
Over a table with 17 million rows, vector dimension 1536. This query is working fine for smaller tables <500k rows. When I run it on my bigger table, I consistently get an error like
```
(psycopg2.OperationalError) server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
```
after ~2 hours. Running on a 48cpu 192gb machine with maintenance_work_mem=48GB. This may be some sort of hidden timeout issue, but I've set my statement timeout to be 1 day and my client side connection has no timeout.
Timeouts aside, are there any recommendations for getting the index build performance to be faster on my machine? I'm able to build indexes with <500k rows quickly (<1 minute) but above that it starts to slow down dramatically.
^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #807: Very Slow HNSW Build for 17M Vectors, 1536 dimensions
@ 2025-03-26 18:44 ` "ankane (@ankane)" <noreply+ankane@github.com>
1 sibling, 0 replies; 3+ messages in thread
From: ankane (@ankane) @ 2025-03-26 18:44 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Hi @jjaikumar-xyla, see the [docs](https://github.com/pgvector/pgvector?tab=readme-ov-file#index-build-time) on index build time. Also, using the default `m` of 16 and `ef_construction` of 64 will build faster.
^ permalink raw [nested|flat] 3+ messages in thread
* Re: [pgvector/pgvector] issue #807: Very Slow HNSW Build for 17M Vectors, 1536 dimensions
@ 2025-03-26 18:44 ` "ankane (@ankane)" <noreply+ankane@github.com>
1 sibling, 0 replies; 3+ messages in thread
From: ankane (@ankane) @ 2025-03-26 18:44 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-03-26 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-26 18:27 [pgvector/pgvector] issue #807: Very Slow HNSW Build for 17M Vectors, 1536 dimensions "jjaikumar-xyla (@jjaikumar-xyla)" <noreply+jjaikumar-xyla@github.com>
2025-03-26 18:44 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-03-26 18:44 ` "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