From: schuemie (@schuemie) <noreply+schuemie@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #569: Duplicate error when creating a vector index using HNSW
Date: Wed, 11 Sep 2024 04:34:30 +0000
Message-ID: <gh-pgvector-pgvector-569-c2342601901@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-569@github.com>
References: <gh-pgvector-pgvector-569@github.com>
I got the same error using v0.7.4. I ran
```sql
SET maintenance_work_mem = '90GB'
SET max_parallel_maintenance_workers = 0
CREATE INDEX ON pubmed.vectors_snowflake_arctic_s USING hnsw (embedding vector_cosine_ops)
```
and after running for 12 hours (I have 37 million 384-dimensional vectors) got
```
ERROR: Key (relname, relnamespace)=(vectors_snowflake_arctic_s_embedding_idx, 23502) already exists.duplicate key value violates unique constraint "pg_class_relname_nsp_index"
ERROR: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
SQL state: 23505
Detail: Key (relname, relnamespace)=(vectors_snowflake_arctic_s_embedding_idx, 23502) already exists.
```
There were no indices left from prior runs (although I did terminate earlier runs because I ran out of memory, but they closed nicely).
Oddly enough, despite the error the index was created, and seems to be complete and working fast.
There may well be duplicate vectors (hard to avoid when you have 37M), but it seems that should be allowed. This should be a non-unique index, right? It is hard to tell if the error is for a duplicate index name or a duplicate index entry.