PgVector is an open-source extension that enables vector similarity search in PostgreSQL.
This image provides a convenient way to deploy and manage pgvector with
CloudNativePG.
Define the pgvector extension under the postgresql.extensions section of
your Cluster resource. For example:
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: cluster-pgvector
spec:
imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
instances: 1
storage:
size: 1Gi
postgresql:
extensions:
- name: pgvector
image:
# renovate: suite=trixie-pgdg depName=postgresql-18-pgvector
reference: ghcr.io/cloudnative-pg/pgvector:0.8.2-18-trixieYou can install pgvector in a specific database by creating or updating a
Database resource. For example, to enable it in the app database:
apiVersion: postgresql.cnpg.io/v1
kind: Database
metadata:
name: cluster-pgvector-app
spec:
name: app
owner: app
cluster:
name: cluster-pgvector
extensions:
- name: vector
# renovate: suite=trixie-pgdg depName=postgresql-18-pgvector
version: '0.8.2'Once the database is ready, connect to it with psql and run:
\dxYou should see vector listed among the installed extensions.