Overview
pg_vectorsearch is an open-source PostgreSQL extension from Tiger Data (the company behind Timescale) for approximate nearest neighbor (ANN) vector search. It adds an index type called PRISM (Partitioned Routing Index for Similarity Matching), an IVF-style index with hierarchical routing that is designed for collections of 100 million vectors and more.

Instead of the graph that HNSW builds, PRISM groups similar vectors into k-means partitions and stores compressed RaBitQ codes, about one bit per dimension, packed into database pages. A query walks a small tree of cluster centroids and then scans the nearest partitions with SIMD (AVX2, AVX512 or NEON). Vectors near a partition boundary can be stored in more than one partition to raise recall, and a two-stage search with error bounds limits how much full-precision reranking is needed.
The extension works with its own `vec32` and `vec16` types and can also index existing pgvector `vector` and `halfvec` columns directly, so a table that uses pgvector keeps its schema and queries. Tiger Data positions it as the successor to pgvectorscale, which it says is moving to maintenance mode. The project is marked alpha: the README says it is meant for testing, not production, and that indexes should be recreated between prereleases.
What it does
- PRISM index: k-means partitions with hierarchical centroid routing, aimed at 100M+ vectors
- RaBitQ quantization with a two-stage, error-bounded search that reduces full-precision reranking
- SIMD distance computation on AVX2, AVX512 and NEON

- Indexes existing pgvector vector and halfvec columns without rewriting the table
- L2, inner-product and cosine operator classes for vec32/vector and vec16/halfvec
- One main tuning knob, prism.nprobe, where 0 targets about 95% recall automatically
- Inserts, updates and deletes, with oversized posting lists split by prism_rebalance or REINDEX
Getting started
pg_vectorsearch builds from source with Meson and needs PostgreSQL 18 or later with development headers and a C11 compiler (GCC 11+ or Clang 14+). Load your data before creating the index, because the index is sized from the row count.
Build and install the extension
Clone the repository and build it in release mode. CBLAS is optional and speeds up RaBitQ encoding.
git clone https://github.com/timescale/pg_vectorsearch.git
cd pg_vectorsearch
meson setup builddir --buildtype=release
meson install -C builddirCreate a table and load vectors
Enable the extension and store embeddings in a vec32 column (use vec16 to halve storage).
CREATE EXTENSION pg_vectorsearch;
CREATE TABLE items (
id serial PRIMARY KEY,
embedding vec32(3) STORAGE PLAIN
);
INSERT INTO items (embedding)
SELECT ARRAY[i::real, (i % 7)::real, (i % 5)::real]::vec32
FROM generate_series(1, 1000) i;Build a PRISM index and query it
Create the index with an operator class, optionally raise nprobe for more recall, then order by distance.
CREATE INDEX ON items USING prism (embedding vec32_l2_ops);
SET prism.nprobe = 40; -- 0 = auto (about 0.95 recall)
SELECT * FROM items
ORDER BY embedding <-> '[3,1,2]'
LIMIT 5;Or index an existing pgvector table
PRISM reads pgvector vector and halfvec columns directly. Map vector_<metric>_ops to vec32_<metric>_ops (halfvec to vec16), check with EXPLAIN that the planner uses it, then drop the old HNSW index if you no longer need it.
CREATE EXTENSION vector;
CREATE EXTENSION pg_vectorsearch;
CREATE INDEX documents_embedding_prism
ON documents USING prism (embedding vec32_l2_ops);Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Running vector search on 100M+ embeddings inside PostgreSQL without a separate vector database
- Replacing a pgvector HNSW index that is too slow to build or too large for available memory
- Serving RAG retrieval with high recall on smaller, cheaper database instances
- Testing a partition-based ANN index alongside an existing pgvector setup before migrating
How pg_vectorsearch compares
pg_vectorsearch alongside other open-source vector databases tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Supabase | ★ 112k | Managed Postgres backend whose Vector toolkit (pgvector) stores, indexes, and queries embeddings next to transactional data. |
| Redis Cloud | ★ 76.8k | Fully-managed Redis with built-in vector search, offering low-latency similarity and hybrid queries over any embeddings. |
| Milvus | ★ 46.4k | A distributed vector database for storing and searching billions of embeddings at scale, with multiple index types and Kubernetes-native deployment. |
| FAISS | ★ 41.2k | A library from Meta for efficient similarity search and clustering of dense vectors, with both exact and approximate indexes. |
| Qdrant | ★ 35.1k | A Rust-based vector search engine that stores embeddings with rich payload filtering for semantic search and recommendation systems. |
| Chroma | ★ 29.5k | A developer-focused vector database designed for quickly building retrieval and RAG features with a simple Python and JavaScript API. |
| pgvector | ★ 23.4k | A PostgreSQL extension that adds a vector data type and similarity search so you can store and query embeddings inside an existing Postgres database. |
| pg_vectorsearch | ★ 269 | A partition-based PRISM index for fast vector search inside PostgreSQL |
