PostgreSQL Field Guide

Install pgvector for PostgreSQL

Install, enable, and verify pgvector with Docker, Ubuntu, or managed cloud PostgreSQL

pgvector is an independent extension, not a core PostgreSQL type. After installing a package or using an image that contains it, run CREATE EXTENSION vector in every target database.

Minimal Docker environment

The pgvector project publishes versioned images based on official Postgres images. This example pins PostgreSQL 18 and pgvector 0.8.2:

docker volume create pgvector18-data

docker run --name pgvector18 \
  --env POSTGRES_PASSWORD=local-only-change-me \
  --publish 5432:5432 \
  --volume pgvector18-data:/var/lib/postgresql/data \
  --detach pgvector/pgvector:0.8.2-pg18-trixie

docker exec -it pgvector18 \
  psql -U postgres -d postgres -c "CREATE EXTENSION vector;"

The password is for an isolated local demonstration, never production configuration. If the name or port is occupied, choose an explicit alternative; do not delete an unknown instance.

Ubuntu / Debian package

Package snapshot evidence · PkgSeek

pgvector in distribution repositories

Indexed
DistributionReleaseIndexed versionRepositoryLinked advisories
AlmaLinux100.6.2-6.el10_0official / AppStream
AlmaLinux90.8.1-1.module_el9.8.0+234+5456f35dofficial / AppStream
Arch Linuxrolling0.8.6-1official / extra
CentOS Stream100.6.2-8.el10official / AppStream
CentOS Stream90.8.1-1.module_el9+1300+1c4aa8dfofficial / AppStream
Fedora420.6.2-4.fc42official / everything
Fedora430.8.0-1.fc43official / everything
Fedora440.8.0-2.fc44official / everything
Oracle Linux100.6.2-6.el10_0official / appstream
Oracle Linux90.6.2-2.module+el9.8.0+90925+e22a792eofficial / appstream
Red Hat Enterprise Linux10.20.6.2-6.el10_0official / AppStream
Red Hat Enterprise Linux9.80.6.2-2.module+el9.8.0+24096+5a959ed6official / AppStream
Rocky Linux100.6.2-6.el10_0official / AppStream
Rocky Linux90.6.2-2.module+el9.8.0+40212+d6f50005official / AppStream
Snapshot checked: Aug 2, 2026, 3:47 PM UTC. Distribution revisions and backported fixes are part of the version identity. A zero count is not a permanent security guarantee.Open package lookup

The same extension may be named pgvector, postgresql18-pgvector, or another server-major-specific package across distributions. This table only shows exact pgvector coordinates; it does not establish whether every versioned package exists.

Package snapshot evidence · PkgSeek

PGDG: postgresql-18-pgvector

No exact indexed coordinate

PkgSeek did not return an exact match for this coordinate. This means “not present in this snapshot”, not “the package does not exist”. Confirm with the upstream repository before acting.

Snapshot checked: Aug 2, 2026, 3:47 PM UTC. Distribution revisions and backported fixes are part of the version identity. A zero count is not a permanent security guarantee.Open package lookup

If no exact coordinate appears above, verify the target PGDG repository metadata. Do not infer an Ubuntu or Debian versioned package name from a generic pgvector record.

After configuring the official PostgreSQL Apt repository, the extension package is bound to the server major:

sudo apt install postgresql-18-pgvector
sudo -u postgres psql -d app -c "CREATE EXTENSION vector;"

Installing at OS level does not enable every database. Verify the actual version:

SELECT extname, extversion
FROM pg_extension
WHERE extname = 'vector';

Before upgrading, read release notes and test this in the target database:

ALTER EXTENSION vector UPDATE;

Minimal query verification

CREATE TABLE vector_demo (
  id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
  embedding vector(3) NOT NULL
);

INSERT INTO vector_demo (embedding)
VALUES ('[1,2,3]'), ('[4,5,6]'), ('[1,1,1]');

SELECT id, embedding <-> '[1,2,2]'::vector AS l2_distance
FROM vector_demo
ORDER BY embedding <-> '[1,2,2]'::vector
LIMIT 2;

Without an approximate index, this is exact search. When scale and real filters justify it, evaluate HNSW or IVFFlat using the pgvector production guide.

Managed cloud PostgreSQL

Managed services commonly restrict host access and extension allowlists. Confirm:

  • engine major and the exact vector extension version;
  • who can run CREATE EXTENSION and ALTER EXTENSION;
  • whether that version supports HNSW, IVFFlat, and iterative scans;
  • whether extensions follow engine upgrades or require manual maintenance;
  • disk, memory, WAL, and replica-lag limits during index builds.

Do not mix different embeddings

When model, dimension, normalization, or distance semantics change, rebuild into a new column or table and evaluate it. Equal dimensions do not make vectors semantically comparable.

Use the pgvector installation documentation for current releases and methods.

Last updated on

On this page