Pg_vectorsearch Introduces PRISM Index to Outperform Pgvector IVFFlat and HNSW
New PostgreSQL Extension Uses RaBitQ Quantization and Hierarchical Routing for Fast Vector Search
1New Native Indexing for Postgres
Pg_vectorsearch introduces PRISM as a PostgreSQL-native index access method for approximate nearest neighbor search. Written in C, the extension is currently in alpha status and intended for testing. It provides a drop-in indexing alternative that significantly speeds up vector queries and index building compared to existing solutions.
2Outperforming HNSW and IVFFlat
PRISM achieves higher search speeds than pgvector's IVFFlat and graph-based HNSW implementations. Benchmark tests on a 100-million-vector dataset demonstrated that PRISM delivers equivalent recall faster than HNSW. Crucially, this performance is achieved on a database instance operating with only one-quarter of the memory required by HNSW.
3Hierarchical Routing and Buffer Cache
PRISM organizes high-dimensional vectors by partitioning them across a hierarchical centroid tree. The architecture relies directly on the PostgreSQL buffer cache to keep the routing tree warm in memory. Incoming queries traverse these centroids to locate nearest clusters before scanning posting lists using asynchronous input and output operations.
4RaBitQ Quantization Mechanics
Vectors inside posting lists are quantized using RaBitQ and stored in page layouts optimized for SIMD distance calculations. The RaBitQ encoding carries theoretical error bounds during filtering. This mathematical bounding allows the engine to eliminate non-candidate vectors early, dramatically reducing full-precision reranking against raw table data.
5Stepwise Query Execution Flow
Query execution follows a structured five-stage pipeline. The planner traverses the centroid tree, scans candidate posting lists, and executes RaBitQ two-stage filtering via estimation and error bounds. Surviving vectors undergo full-precision reranking fetched directly from the heap before the index returns the final k nearest neighbors.
6Binary Compatibility with Pgvector
The extension introduces vec32 and vec16 data types that are binary-compatible with pgvector's vector and halfvec columns. Users can build PRISM indexes directly on existing pgvector tables without rewriting data. Both extensions can run concurrently within the same schema while queries utilize standard distance operators.
7Tuning and Search Calibration
PRISM simplifies index maintenance by relying on defaults tuned from large-scale benchmarks. Search precision is controlled primarily through the prism.nprobe configuration parameter, where zero enables automatic tuning for roughly 0.95 recall. Operators support standard distance metrics, mapping directly to L2, inner product, and cosine workflows.
8Posting List Maintenance Constraints
Because new vector inserts append directly to routed posting lists without automatic splitting, list sizes expand over time. Alongside standard REINDEX operations, administrators can run the prism_rebalance procedure to split oversized lists in place. Development builds rely on the Meson build system under the standard PostgreSQL License.