Skip to content

pg_certvec_v2

Research multi-vector similarity search over external certified indexes

PM-MaxSim · Research multi-vector similarity search over external certified indexes

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102459pg_certvec_v2PM-MaxSim1.0RAGMITC++

PostgreSQL · 17

Usage

Sources:

pg_certvec_v2 1.0 is the experimental CertVec PostgreSQL 17 integration in PM-MaxSim. It combines predicate-filtered vector retrieval, SQL aggregates and a CustomScan path with an external C++20 index engine. The reviewed artifact targets PostgreSQL 17.12; benchmark claims are not a compatibility or production-readiness guarantee.

Enable the Reviewed SQL Surface

The upstream installation harness explicitly installs src_v4/pg_certvec--1.0.sql as pg_certvec_v2--1.0.sql beside the matching control and library. This filename mapping is essential: the repository also retains an older pg_certvec control/library with a different symbol set. Do not mix the old library with the v2 SQL.

Install the matching PostgreSQL module and make libpm_certvec plus its dependencies available to the server. Preserve the existing preload list when adding the module, restart PostgreSQL, then enable it as a superuser.

shared_preload_libraries = 'pg_certvec_v2'
CREATE EXTENSION pg_certvec_v2;
SELECT extversion FROM pg_extension WHERE extname = 'pg_certvec_v2';

The native engine depends on CRoaring and C++20; optional Linux acceleration and I/O libraries are separate from PostgreSQL extension dependencies. The supplied benchmark harness contains machine-specific work directories and resource settings, so it is not a general deployment script.

Query an Existing Index

Prepare a compatible external CertVec index, a matching integer doc_id relation and a correctly shaped packed float32 query vector. In this psql example, query_hex contains the packed query bytes; the index directory is readable by the PostgreSQL OS account.

SELECT *
FROM pm_certvec_topk(
    '/data/docs768', '',
    (SELECT pm_roaring_agg(doc_id) FROM docs WHERE nc5 = true),
    decode(:'query_hex', 'hex'),
    1, 10, 0.05, 128, 3000
);

pm_roaring_agg(int4) builds the serialized candidate filter; pm_aux_agg(int4, float4) builds auxiliary scores. pm_certvec_topk, pm_certvec_thresh, and pm_certvec_hybrid_topk return document IDs and scores. certvec_score and certvec_hybrid_score support declarative plans; inspect EXPLAIN for CertVecScan rather than assuming every SQL shape is rewritten.

Index, Cache and Safety Boundaries

pm_certvec_info, pm_certvec_cache_stats, and pm_certvec_reset_cache_stats inspect an external index and its cache. The pg_certvec.* GUC prefix is retained for v2, including pg_certvec.cache_mb, pg_certvec.tier_mode, pg_certvec.use_o_direct, and pg_certvec.enable_custom_scan. Shared-cache sizing is configured before server startup.

This is not a PostgreSQL CREATE INDEX access method. Index generation, external file lifecycle and correspondence with table rows require the artifact workflow; do not assume ordinary table writes maintain those files. Keep backups of both table data and matching index artifacts. Each backend caches at most eight open index/sidecar pairs in the reviewed implementation.

Use trusted callers and correctly formed binary inputs: the SQL surface exposes server-side file paths and native byte parsing. The reviewed bundle has no extension upgrade script or additional PostgreSQL-major compatibility evidence.

Table reader