pg_proven
pg_proven · Nearest-neighbour and vector-set indexing for pgvector types
Overview
PostgreSQL · 17, 18
| Relationships | |
|---|---|
| Requires | vector |
Usage
Sources:
pg_proven 0.1.0 provides the proven index access method for vector and vector[] values. The reviewed source targets PostgreSQL 17/18 with pgvector. Its control file and pgrx SQL declarations define a superuser-only, nonrelocatable extension; shared preload is not required.
Nearest Neighbours
The default proven.probes = 0 and proven.recall = 1 scan all lists with executor distance rechecks. L2 uses vector_l2_ops and <->; cosine uses vector_cosine_ops and <=>. NULL vectors and cosine zero vectors are not indexed; a large LIMIT can therefore return fewer rows than a sequential scan, and equal-distance ties need not have the same order. Extra indexed int4 or int8 columns support filtering; other filters run after the index scan.
Approximation and Vector Sets
A recall value below one selects lists using measurements on the index’s own rows; it is not a recall guarantee for new queries or later inserts. A positive proven.probes takes precedence. proven.k overrides the initial result budget. Vector-array operator classes vector_set_l2_ops and vector_set_cosine_ops support nearest-member ordering and ==> predicates built with vquery_l2 or vquery; boolean names describe whether members lie within the supplied radius. Inner product, halfvec and sparsevec are not supported.
Storage and Maintenance
Index pages use WAL and participate in replication and backup. Searches use a derived mmap cache in $PGDATA/pg_proven/, which can be rebuilt from those pages and roughly doubles disk storage. VACUUM removes dead rows and folds insert deltas; proven_fold requests a fold explicitly. Inserts that cross the folding threshold can wait for that work. Use REINDEX after material data drift or to rebuild an index initially created on an empty table.
Build working memory is not bounded by maintenance_work_mem. Verify plans and compare results against sequential scans before relying on this early implementation. Returned ctid values are unsuitable as stable identifiers, including the documented reorder-queue limitation.