Skip to content

pg_vectorsearch

Approximate vector search with PRISM indexes and RaBitQ quantization

pg_vectorsearch · Approximate vector search with PRISM indexes and RaBitQ quantization

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1990pg_vectorsearchpg_vectorsearch0.2.0RAGPostgreSQLC
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--NoYesNoYesnono
Relationships
See Alsovector vectorscale
Alpha; PG18 packages; OpenBLAS required; no pgvector dependency; no in-place RC upgrade.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.2.019 18 17 16 15pg_vectorsearch-
RPMPIGSTY0.2.019 18 17 16 15pg_vectorsearch_$v-
DEBPIGSTY0.2.019 18 17 16 15postgresql-$v-vectorsearch-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.2.0N/AN/AN/A
el8.aarch64N/APIGSTY 0.2.0N/AN/AN/A
el9.x86_64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
el9.aarch64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
el10.x86_64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
el10.aarch64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
d12.x86_64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
d12.aarch64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
d13.x86_64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
d13.aarch64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
u22.x86_64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
u22.aarch64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
u24.x86_64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
u24.aarch64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
u26.x86_64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
u26.aarch64PIGSTY 0.2.0PIGSTY 0.2.0N/AN/AN/A
PackageVersionOSORGSIZEFile URL
pg_vectorsearch_190.2.0el9.x86_64pigsty579.4 KiBpg_vectorsearch_19-0.2.0-1PGSTY.el9.x86_64.rpm
pg_vectorsearch_190.2.0el9.aarch64pigsty510.5 KiBpg_vectorsearch_19-0.2.0-1PGSTY.el9.aarch64.rpm
pg_vectorsearch_190.2.0el10.x86_64pigsty585.7 KiBpg_vectorsearch_19-0.2.0-1PGSTY.el10.x86_64.rpm
pg_vectorsearch_190.2.0el10.aarch64pigsty518.5 KiBpg_vectorsearch_19-0.2.0-1PGSTY.el10.aarch64.rpm
postgresql-19-vectorsearch0.2.0d12.x86_64pigsty549.2 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~bookworm_amd64.deb
postgresql-19-vectorsearch0.2.0d12.aarch64pigsty477.5 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~bookworm_arm64.deb
postgresql-19-vectorsearch0.2.0d13.x86_64pigsty548.9 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~trixie_amd64.deb
postgresql-19-vectorsearch0.2.0d13.aarch64pigsty479.9 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~trixie_arm64.deb
postgresql-19-vectorsearch0.2.0u22.x86_64pigsty583.4 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~jammy_amd64.deb
postgresql-19-vectorsearch0.2.0u22.aarch64pigsty522.8 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~jammy_arm64.deb
postgresql-19-vectorsearch0.2.0u24.x86_64pigsty574.7 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~noble_amd64.deb
postgresql-19-vectorsearch0.2.0u24.aarch64pigsty509.5 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~noble_arm64.deb
postgresql-19-vectorsearch0.2.0u26.x86_64pigsty575.0 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~resolute_amd64.deb
postgresql-19-vectorsearch0.2.0u26.aarch64pigsty509.6 KiBpostgresql-19-vectorsearch_0.2.0-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_vectorsearch_180.2.0el8.x86_64pigsty584.9 KiBpg_vectorsearch_18-0.2.0-1PGSTY.el8.x86_64.rpm
pg_vectorsearch_180.2.0el8.aarch64pigsty505.4 KiBpg_vectorsearch_18-0.2.0-1PGSTY.el8.aarch64.rpm
pg_vectorsearch_180.2.0el9.x86_64pigsty578.0 KiBpg_vectorsearch_18-0.2.0-1PGSTY.el9.x86_64.rpm
pg_vectorsearch_180.2.0el9.aarch64pigsty510.5 KiBpg_vectorsearch_18-0.2.0-1PGSTY.el9.aarch64.rpm
pg_vectorsearch_180.2.0el10.x86_64pigsty583.8 KiBpg_vectorsearch_18-0.2.0-1PGSTY.el10.x86_64.rpm
pg_vectorsearch_180.2.0el10.aarch64pigsty518.1 KiBpg_vectorsearch_18-0.2.0-1PGSTY.el10.aarch64.rpm
postgresql-18-vectorsearch0.2.0d12.x86_64pigsty547.6 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~bookworm_amd64.deb
postgresql-18-vectorsearch0.2.0d12.aarch64pigsty477.2 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~bookworm_arm64.deb
postgresql-18-vectorsearch0.2.0d13.x86_64pigsty547.1 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~trixie_amd64.deb
postgresql-18-vectorsearch0.2.0d13.aarch64pigsty480.5 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~trixie_arm64.deb
postgresql-18-vectorsearch0.2.0u22.x86_64pigsty581.7 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~jammy_amd64.deb
postgresql-18-vectorsearch0.2.0u22.aarch64pigsty522.6 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~jammy_arm64.deb
postgresql-18-vectorsearch0.2.0u24.x86_64pigsty572.7 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~noble_amd64.deb
postgresql-18-vectorsearch0.2.0u24.aarch64pigsty509.5 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~noble_arm64.deb
postgresql-18-vectorsearch0.2.0u26.x86_64pigsty572.5 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~resolute_amd64.deb
postgresql-18-vectorsearch0.2.0u26.aarch64pigsty509.6 KiBpostgresql-18-vectorsearch_0.2.0-1PGSTY~resolute_arm64.deb

Source

pig build pkg pg_vectorsearch;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_vectorsearch;		# install by package name

pig install pg_vectorsearch -v 19;   # install for PG 19
pig install pg_vectorsearch -v 18;   # install for PG 18

Create this extension with:

CREATE EXTENSION pg_vectorsearch;

Usage

Sources:

pg_vectorsearch 0.2.0 is an alpha extension for approximate nearest-neighbor search with the PRISM index. It supports PostgreSQL 18 and 19, native vec32 / vec16 types and optional pgvector interoperability. It is intended for testing, with evolving behavior and maintenance requirements.

Core Workflow

CREATE EXTENSION pg_vectorsearch;
CREATE TABLE vectorsearch_items (
    id serial PRIMARY KEY,
    embedding vec32(3) STORAGE PLAIN
);
INSERT INTO vectorsearch_items (embedding)
SELECT ARRAY[i::real, (i % 7)::real, (i % 5)::real]::vec32
FROM generate_series(1, 1000) AS i;
CREATE INDEX vectorsearch_items_prism ON vectorsearch_items
USING prism (embedding vec32_l2_ops);
SET prism.nprobe = 40;
SELECT id FROM vectorsearch_items
ORDER BY embedding <-> '[3,1,2]' LIMIT 5;

Operational Boundaries

Install as a superuser; no preload is required and the extension is not relocatable. The prism access method has vec32_l2_ops, vec32_ip_ops, vec32_cosine_ops and corresponding vec16 operator classes; <->, <#> and <=> express L2, negative inner product and cosine distance. prism.nprobe trades recall for query work; zero selects automatic tuning, not exact recall.

Load representative data before building the index. L2 and cosine indexes support up to 8192 dimensions: any dimension through 1968, then a power of two times an odd factor at most eight. Inner-product indexes remain limited to 1968 for vec32 and 3584 for vec16. Expression and unlogged indexes are unsupported. Keep prism.leaf_refine_threshold at zero. Filtering can return fewer rows than LIMIT, and candidate buffers bounded by work_mem can truncate large or unbounded results. Measure against an exact baseline.

Inspect prism_index_settings and follow the maintenance guide for churn. prism_rebalance supports only flat RaBitQ centroid-page indexes with centroid_fastscan off, not the default multilevel format. DELETE leaves tombstones, and retired pages are reclaimed only by REINDEX. There is no in-place upgrade from the earlier release candidates.

Upgrade to 0.2.0

Install matching files, start a fresh session that has not loaded the old library, update the SQL extension and rebuild every PRISM index:

ALTER EXTENSION pg_vectorsearch UPDATE TO '0.2.0';
REINDEX INDEX vectorsearch_items_prism;

Old index format 0x06 is rejected by the 0x07 reader. The two library versions cannot share one session. vec32_norm is renamed to l2_norm; the vec16 overload of vec32_dims becomes vec16_dims, while vector_dims provides the pgvector-compatible interface. Update direct callers of renamed functions; dependent views retain function OIDs.

posting_reference_format defaults to float16. A reference element beyond ±65504 causes a build or split error; use float32 when needed. The vec16 type now rejects out-of-range input. Existing filter, buffer-size and maintenance limits still apply.

Table reader