Skip to content

pg_vectorsearch

Approximate vector search with PRISM indexes and RaBitQ quantization

Overview

PackageVersionCategoryLicenseLanguage
pg_vectorsearch0.1.0RAGPostgreSQLC
IDExtensionBinLibLoadCreateTrustRelocSchema
1990pg_vectorsearchNoYesNoYesNoNo-

Alpha; PG18 packages; OpenBLAS required; no pgvector dependency; no in-place RC upgrade.

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.1.01817161514pg_vectorsearch-
RPMPIGSTY0.1.01817161514pg_vectorsearch_$v-
DEBPIGSTY0.1.01817161514postgresql-$v-vectorsearch-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64N/AN/AN/AN/A
el8.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A
el9.x86_64N/AN/AN/AN/A
el9.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A
el10.x86_64
PIGSTY 0.1.0
N/AN/AN/AN/A
el10.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A
d12.x86_64N/AN/AN/AN/A
d12.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A
d13.x86_64
PIGSTY 0.1.0
N/AN/AN/AN/A
d13.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A
u22.x86_64
PIGSTY 0.1.0
N/AN/AN/AN/A
u22.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A
u24.x86_64
PIGSTY 0.1.0
N/AN/AN/AN/A
u24.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A
u26.x86_64N/AN/AN/AN/A
u26.aarch64
PIGSTY 0.1.0
N/AN/AN/AN/A

Build

You can build the RPM / DEB packages for pg_vectorsearch using pig build:

pig build pkg pg_vectorsearch         # build RPM / DEB packages

Install

You can install pg_vectorsearch directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

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

Install the extension using pig or apt/yum/dnf:

Install
pig install pg_vectorsearch;          # Install for current active PG version
pig
pig ext install -y pg_vectorsearch -v 18  # PG 18
dnf
dnf install -y pg_vectorsearch_18       # PG 18
apt
apt install -y postgresql-18-vectorsearch   # PG 18

Create Extension:

CREATE EXTENSION pg_vectorsearch;

Usage

Sources:

pg_vectorsearch 0.1.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. Indexed dimensions are limited to 1968; 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.

Was this page helpful?