From 251f22c46fb470ddc545e9ad6cd6971551c07f7b Mon Sep 17 00:00:00 2001 From: Ruben Hensen Date: Sat, 24 Oct 2026 02:02:02 +0200 Subject: [PATCH] immich: add a PostgreSQL 17 cluster with VectorChord Imported once from the PostgreSQL 14 cluster, whose embeddings were converted to real[] and whose pgvecto.rs extension was dropped first (immich's manual migration). After the import the columns become vector(512) again under VectorChord 1.1.1 with pgvector 0.8.6. A logical import because CNPG can't upgrade in place from the bullseye-based pgvecto.rs image to the bookworm-based VectorChord one. --- immich/postgresql-cluster-17.yaml | 50 +++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 immich/postgresql-cluster-17.yaml diff --git a/immich/postgresql-cluster-17.yaml b/immich/postgresql-cluster-17.yaml new file mode 100644 index 0000000..ea665d0 --- /dev/null +++ b/immich/postgresql-cluster-17.yaml @@ -0,0 +1,50 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: immich-postgres-17 + namespace: immich +spec: + instances: 1 + + # CNPG image with VectorChord and pgvector, which immich 2.x and 3.x use + # for its vector indexes (pgvecto.rs is gone in immich 3.0). + imageName: ghcr.io/tensorchord/cloudnative-vectorchord:17.11-1.1.1 + + postgresql: + shared_preload_libraries: + - "vchord.so" + + # Filled once from the PostgreSQL 14 cluster (immich-postgres) after its + # embedding columns were turned into real[] and pgvecto.rs was dropped, + # see docs/upgrade-k8s-1.33.md. + bootstrap: + initdb: + database: immich + owner: immich + import: + type: microservice + databases: + - immich + source: + externalCluster: immich-postgres + postImportApplicationSQL: + - CREATE EXTENSION IF NOT EXISTS vchord CASCADE; + - ALTER TABLE public.smart_search ALTER COLUMN embedding SET DATA TYPE vector(512); + - ALTER TABLE public.face_search ALTER COLUMN embedding SET DATA TYPE vector(512); + # immich manages its own extensions and migrations + - ALTER USER immich WITH SUPERUSER; + + externalClusters: + - name: immich-postgres + connectionParameters: + host: immich-postgres-rw + user: immich + dbname: immich + sslmode: require + password: + name: immich-postgres-app + key: password + + storage: + size: 20Gi + storageClass: longhorn