pg.ddx.io pgvector/pgvector GitHub issues and pull requests
help / color / mirror / Atom feed[pgvector/pgvector] issue #754: PGVector 0.7.4 and 0.8.0 on Postgres 17 breaks HNSW CREATE INDEX on Root Partition Table
5+ messages / 2 participants
[nested] [flat]
* [pgvector/pgvector] issue #754: PGVector 0.7.4 and 0.8.0 on Postgres 17 breaks HNSW CREATE INDEX on Root Partition Table
@ 2025-01-09 20:04 "JustinMGaiam (@JustinMGaiam)" <noreply+JustinMGaiam@github.com>
0 siblings, 0 replies; 5+ messages in thread
From: JustinMGaiam (@JustinMGaiam) @ 2025-01-09 20:04 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
The SQL error `ERROR: operator class "vector_cosine_ops" does not exist for access method "hnsw"` is thrown in Postgres 17 using PGVector 0.7.4 and 0.8.0 for the SQL below. This does not happen on Postgres 15 or 16 with up to PGVector 0.7.4.
```
start transaction;
CREATE EXTENSION IF NOT EXISTS "vector";
CREATE TABLE IF NOT EXISTS public.embeddings (
language VARCHAR(2) NOT NULL DEFAULT 'en',
id INT8 NOT NULL,
document_text TEXT NOT NULL,
embedding VECTOR(1536) NOT NULL,
metadata JSONB NOT NULL DEFAULT '{}'::JSONB,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NULL
) partition by list(language);
CREATE TABLE IF NOT EXISTS public.embeddings_en PARTITION OF embeddings FOR VALUES IN ('en');
CREATE TABLE IF NOT EXISTS public.embeddings_es PARTITION OF embeddings FOR VALUES IN ('es');
CREATE TABLE IF NOT EXISTS public.embeddings_fr PARTITION OF embeddings FOR VALUES IN ('fr');
CREATE TABLE IF NOT EXISTS public.embeddings_de PARTITION OF embeddings FOR VALUES IN ('de');
ALTER TABLE "embeddings" ADD CONSTRAINT "embeddings_pkey" PRIMARY KEY ("language", "id");
CREATE INDEX "embeddings_id" ON "embeddings" ("id");
CREATE INDEX "embeddings_embedding_cosine_idx" ON "embeddings" USING hnsw ("embedding" vector_cosine_ops);
commit;
```
The same SQL rewritten as follows does not produce the error. The difference being the partition are individually indexed and then attached to the root partition.
```
start transaction;
CREATE EXTENSION IF NOT EXISTS "vector";
CREATE TABLE IF NOT EXISTS public.embeddings (
language VARCHAR(2) NOT NULL DEFAULT 'en',
id INT8 NOT NULL,
document_text TEXT NOT NULL,
embedding VECTOR(1536) NOT NULL,
metadata JSONB NOT NULL DEFAULT '{}'::JSONB,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NULL
) partition by list(language);
CREATE TABLE IF NOT EXISTS public.embeddings_en PARTITION OF embeddings FOR VALUES IN ('en');
CREATE TABLE IF NOT EXISTS public.embeddings_es PARTITION OF embeddings FOR VALUES IN ('es');
CREATE TABLE IF NOT EXISTS public.embeddings_fr PARTITION OF embeddings FOR VALUES IN ('fr');
CREATE TABLE IF NOT EXISTS public.embeddings_de PARTITION OF embeddings FOR VALUES IN ('de');
ALTER TABLE "embeddings" ADD CONSTRAINT "embeddings_pkey" PRIMARY KEY ("language", "id");
CREATE INDEX "embeddings_id" ON "embeddings" ("id");
CREATE INDEX "embeddings_embedding_cosine_idx" ON ONLY "embeddings" USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX "embeddings_en_embedding_cosine_idx" ON "embeddings_en" USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX "embeddings_es_embedding_cosine_idx" ON "embeddings_es" USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX "embeddings_fr_embedding_cosine_idx" ON "embeddings_fr" USING hnsw ("embedding" vector_cosine_ops);
CREATE INDEX "embeddings_de_embedding_cosine_idx" ON "embeddings_de" USING hnsw ("embedding" vector_cosine_ops);
ALTER INDEX embeddings_embedding_cosine_idx ATTACH PARTITION embeddings_en_embedding_cosine_idx;
ALTER INDEX embeddings_embedding_cosine_idx ATTACH PARTITION embeddings_es_embedding_cosine_idx;
ALTER INDEX embeddings_embedding_cosine_idx ATTACH PARTITION embeddings_fr_embedding_cosine_idx;
ALTER INDEX embeddings_embedding_cosine_idx ATTACH PARTITION embeddings_de_embedding_cosine_idx;
commit;
```
The error can reproduced on the following docker containers:
- pgvector/pgvector:0.7.4-pg17
- pgvector/pgvector:0.8.0-pg17
Both SQL statements work correctly on following docker containers:
- pgvector/pgvector:0.7.4-pg16
- pgvector/pgvector:0.7.4-pg15
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #754: PGVector 0.7.4 and 0.8.0 on Postgres 17 breaks HNSW CREATE INDEX on Root Partition Table
@ 2025-01-09 20:10 "JustinMGaiam (@JustinMGaiam)" <noreply+JustinMGaiam@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: JustinMGaiam (@JustinMGaiam) @ 2025-01-09 20:10 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
@JustinMGaiam renamed this.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #754: PGVector 0.7.4 and 0.8.0 on Postgres 17 breaks HNSW CREATE INDEX on Root Partition Table
@ 2025-01-10 05:48 "ankane (@ankane)" <noreply+ankane@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: ankane (@ankane) @ 2025-01-10 05:48 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Hi @JustinMGaiam, this is a bug in Postgres 17.0 that's fixed in 17.1 (the images use 17.0).
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #754: PGVector 0.7.4 and 0.8.0 on Postgres 17 breaks HNSW CREATE INDEX on Root Partition Table
@ 2025-01-10 05:48 "ankane (@ankane)" <noreply+ankane@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: ankane (@ankane) @ 2025-01-10 05:48 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
@ankane closed this.
^ permalink raw [nested|flat] 5+ messages in thread
* Re: [pgvector/pgvector] issue #754: PGVector 0.7.4 and 0.8.0 on Postgres 17 breaks HNSW CREATE INDEX on Root Partition Table
@ 2025-01-10 18:29 "JustinMGaiam (@JustinMGaiam)" <noreply+JustinMGaiam@github.com>
3 siblings, 0 replies; 5+ messages in thread
From: JustinMGaiam (@JustinMGaiam) @ 2025-01-10 18:29 UTC (permalink / raw)
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
@ankane thank you I will keep an eye out for an update to the docker repository
https://hub.docker.com/r/pgvector/pgvector
^ permalink raw [nested|flat] 5+ messages in thread
end of thread, other threads:[~2025-01-10 18:29 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-01-09 20:04 [pgvector/pgvector] issue #754: PGVector 0.7.4 and 0.8.0 on Postgres 17 breaks HNSW CREATE INDEX on Root Partition Table "JustinMGaiam (@JustinMGaiam)" <noreply+JustinMGaiam@github.com>
2025-01-09 20:10 ` "JustinMGaiam (@JustinMGaiam)" <noreply+JustinMGaiam@github.com>
2025-01-10 05:48 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-01-10 05:48 ` "ankane (@ankane)" <noreply+ankane@github.com>
2025-01-10 18:29 ` "JustinMGaiam (@JustinMGaiam)" <noreply+JustinMGaiam@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