-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
The PgVectorStore implementation of the Vector Store keeps creating a new index on the embedding column even if an index on that column already exists.
I believe the index needs to be created only if it does not exist.
Running the application multiple times keeps creating new indexes. This will result in redundant indexes and increased storage.
See behaviour below -
The first time I run the application with PGVector dependencies.
vector_store=# \d vector_store
Table "public.vector_store"
Column | Type | Collation | Nullable | Default
-----------+--------------+-----------+----------+--------------------
id | uuid | | not null | uuid_generate_v4()
content | text | | |
metadata | json | | |
embedding | vector(1536) | | |
Indexes:
"vector_store_pkey" PRIMARY KEY, btree (id)
"vector_store_embedding_idx" hnsw (embedding vector_cosine_ops)
The second time I run the application.
vector_store-# \d vector_store
Table "public.vector_store"
Column | Type | Collation | Nullable | Default
-----------+--------------+-----------+----------+--------------------
id | uuid | | not null | uuid_generate_v4()
content | text | | |
metadata | json | | |
embedding | vector(1536) | | |
Indexes:
"vector_store_pkey" PRIMARY KEY, btree (id)
"vector_store_embedding_idx" hnsw (embedding vector_cosine_ops)
"vector_store_embedding_idx1" hnsw (embedding vector_cosine_ops)
"vector_store_embedding_idx2" hnsw (embedding vector_cosine_ops)
Metadata
Metadata
Assignees
Labels
No labels