pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: jjaikumar-xyla (@jjaikumar-xyla) <noreply+jjaikumar-xyla@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: [pgvector/pgvector] issue #807: Very Slow HNSW Build for 17M Vectors, 1536 dimensions
Date: Wed, 26 Mar 2025 18:27:07 +0000
Message-ID: <gh-pgvector-pgvector-807@github.com> (raw)

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.

view thread (3+ messages)  latest in thread

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