The Spectrum Dispatch News

technology

PostgreSQL launches pg_vectorsearch for faster vector indexing

A new alpha extension claims faster approximate nearest neighbor search than pgvector's existing IVFFlat and HNSW indexes.

PostgreSQL launches pg_vectorsearch for faster vector indexing

Timescale has released pg_vectorsearch, a PostgreSQL extension for high-performance approximate nearest neighbor (ANN) search currently in alpha status. According to the GitHub repository, the extension introduces PRISM (Partitioned Routing Index for Similarity Matching), an index access method designed to outperform pgvector’s existing IVFFlat and HNSW indexing approaches.

PostgreSQL launches pg_vectorsearch for faster vector indexing

The PRISM index is built around hierarchical routing, quantization, and partitioning techniques implemented in C. According to the documentation, it achieves faster query and index-building performance compared to pgvector’s alternatives. In benchmarks on a 100-million-vector dataset, PRISM reportedly delivered faster query performance than HNSW at equivalent recall while using a quarter of the memory on the test instance.

The extension uses several technical optimizations to achieve this performance. It employs a hierarchical centroid tree to partition vectors into clusters, leverages PostgreSQL’s buffer cache to keep that tree in memory, and uses RaBitQ quantization to encode vectors stored in posting lists. The quantization method carries theoretical error bounds that allow the search algorithm to eliminate vectors that cannot be nearest neighbors, reducing the number of vectors requiring full-precision reranking.

PRISM supports three distance metrics—L2 (default), inner product, and cosine—with dedicated operator classes for each. The extension is compatible with existing pgvector installations, allowing users to build PRISM indexes directly on vector or halfvec columns without modifying tables or queries. Alternatively, new deployments can use pg_vectorsearch’s native vec32 (float32) or vec16 (float16) column types.

The extension requires PostgreSQL 18 or later with development headers, a GNU C11-compliant compiler (GCC 11+ or Clang 14+), and the Meson build system. Optional CBLAS support accelerates RaBitQ encoding. The project notes that pg_vectorsearch is currently alpha software intended for testing, not production use. Upgrading between pre-releases may not be possible and may require dropping and recreating indexes.

Key facts

  • pg_vectorsearch introduces PRISM, an index claimed faster than pgvector’s IVFFlat and HNSW for querying and index building
  • PRISM achieved faster performance than HNSW on a 100-million-vector dataset using a quarter of the memory
  • The extension uses hierarchical centroid trees, RaBitQ quantization, and SIMD-optimized distance computation
  • pg_vectorsearch is compatible with existing pgvector tables and can index vector or halfvec columns without modification
  • The extension is currently in alpha status and intended for testing, not production environments
  • PRISM supports L2, inner product, and cosine distance metrics

Sources

← All posts