Today we're open-sourcing pg_vectorsearch, a new vector search extension for PostgreSQL.
The performance improvements over HNSW are pretty remarkable. At 100 million vectors:
◆︎ Faster queries, 4× less RAM: 6 ms vs. 8 ms at 95% recall, using 128 GB vs. 512 GB RAM. HNSW couldn't even build on 128 GB.
◆︎ 7× smaller indexes: 25 GB vs. 180 GB at 100M vectors.
◆︎ 50× faster index builds: 49 minutes vs. 42 hours on identical hardware.
And at 1 million vectors, PRISM delivers 15 ms queries at 99% recall on just 2 GB RAM, versus HNSW's 392 ms on 4 GB.
What leads to these improvements? Rather than traversing an HNSW graph with random memory accesses, our new PRISM index partitions vectors based on distance, compresses them using RaBitQ, and scans them efficiently using SIMD vectorization techniques. This takes better advantage of modern CPUs and memory locality.
This is actually our second open-source vector index. We learned a lot from building DiskANN-based pgvectorscale, including some important limitations of graph-based approaches. Those lessons convinced us there was a better architectural foundation, so we started over.
pg_vectorsearch is still in alpha, with more engineering ahead. But we believe fast, scalable vector search should live alongside your relational data, without requiring a separate vector database.
Released under the permissive PostgreSQL License, just like our pg_textsearch extension for BM25 keyword search. Together, they provide the building blocks for hybrid vector + keyword search in PostgreSQL.
Feedback and contributions welcome!
Code and blog post below.
⚡️⚡️⚡️