r/PostgreSQL • • 5d ago

Tools Tiger Data announced pg_vectorsearch: Scalable Open-Source Vector Search in PostgreSQL

https://www.tigerdata.com/blog/announcing-pg_vectorsearch-scalable-open-source-vector-search-postgresql

Tiger Data has released pg_vectorsearch, an open source PostgreSQL extension for vector similarity search, currently in alpha. Its PRISM index uses data partitioning and compression instead of the graph-based approach used by pgvector’s HNSW index, reducing memory requirements and index build times.

According to the authors, pg_vectorsearch enables faster, more memory-efficient vector search directly in PostgreSQL, reducing the infrastructure required to handle large vector datasets. The extension supports existing pgvector columns, allowing applications to perform vector search without a separate database. To use the new capabilities, developers must install the extension and create a PRISM index on the vector column:

CREATE EXTENSION pg_vectorsearch;
CREATE INDEX ON documents USING prism (embedding vec32_l2_ops);

In Tiger Data’s own benchmarks using 100 million vectors, PRISM built an index in 1 hour and 40 minutes on a machine with 128 GB of memory, while HNSW (Hierarchical Navigable Small World) took 42 hours on a machine with 512 GB of memory. Formerly known as Timescale, Tiger Data is the company behind TimescaleDB, the open source PostgreSQL extension for time-series data and real-time analytics.

51 Upvotes

11 comments sorted by

5

u/kabooozie 5d ago

Didn’t Pinecone also release a postgres extension for vector search? Can someone more knowledgeable here contextualize what it means to have all these vector search extensions and the implications for these vendors?

3

u/jews4beer 5d ago edited 5d ago

As someone who has spent a considerable amount of time the last few months trying to optimize vector search at $work.

I'm not familiar with Pinecone, but pg_vector is primarily used for the HNSW index. But the problem is it doesn't support quantization options (read: compression of the vectors inside the graph) and when trying to use filters (read: WHERE clauses) with the graph you end up hopping through it many times. This means at hundreds of millions of vectors, you'll need 1TB+ of memory (depending on vector size of course) and you'll still be hitting tail latencies close to a minute depending on the query.

Other vector databases like Milvus, Qdrant, Weaviate, etc. support more index types and quantization methods to allow you to tune for recall vs cost vs latency vs throughput. They also have optimizations specifically centered around doing filtered searches through the index to avoid multi-hopping. Milvus specifically runs a distributed architecture where all the data lives in buckets and if you want to query it you basically "load it into memory". If you need more memory, you just add more nodes. They claim to be able to scale to billions of vectors and my tests haven't proven them wrong. But definitely at a price.

Companies sponsoring postgres extensions seem to be trying to address their shortcomings now. In this case it's a different index method and they are using a form of vector compression called binary quantization (which is where the lower memory footprint is primarily coming from). It also doesn't seem configurable. That's where I think all these attempts to bring true vector search at scale to postgres will keep falling down. They are constrained by the architecture (e.g. you eventually need to shard/replicate) and still playing catchup with the dedicated options (e.g. 1 compression option here, Qdrant/Milvus/Etc have like 10+ as well as 10+ different index types you can choose from).

2

u/SpiritedSilicon 5d ago

Hi u/kabooozie! This is Arjun from Pinecone DevRel.

Yes, we’ve released pg_pinecone, which is an open source postgres extension that is compatible with pgvector. It’s meant to bring an open source, efficient, pinecone-like experience to postgres users.

You can read in our blog here that it’s much more efficient and faster than pgvector. For us, this is one way  to give postgres devs a Pinecone experience in where they already are, superior to pgvector, especially for filtered searches.

Our extension can be run entirely locally for free without signing up for Pinecone at all, but, it offers a “remote mode that lets you sync vectors to Pinecone if you hit the necessary scale.

So, for us, it’s about providing a better experience for developers considering pgvector and the like.

Here's the post: https://www.pinecone.io/blog/introducing-pg-pinecone/

And the repo: https://github.com/pinecone-io/pg_pinecone

1

u/kabooozie 5d ago

Ah that makes sense. It’s a go-to-market strategy where you see folks starting with postgres anyway, so you meet them where they are and then make it easy for them to migrate to Pinecone when the scale increases. At the end of the day it’s better search on postgres, so as a postgres user I’m happy

2

u/SpiritedSilicon 5d ago

Exactly! I've love to hear your experience if you end up trying it. Send me a dm and we can chat if you'd like to :). Our goal is to give something great to the community. It's our first open-source release related to how Pinecone works! And to be clear, you never ever have to migrate to Pinecone if you don't need to. You can self deploy using something like Railway or the like, like this: https://railway.com/deploy/pg-pinecone

Or just use locally, which is what I like doing!

2

u/c-digs 5d ago

What's the roadmap look like for getting this into managed providers like Azure, AWS, GCP?  Any work stream with those teams?

Will that end up dual licensed if it happens?  

1

u/Discordbothost 3d ago

For a workload that always filters on tenant_id, I'd benchmark an exact scan over each tenant's rows too. That gives you the ground truth for recall@10 and a realistic baseline when a tenant only has a few hundred vectors. I'd want to see p95 latency for small and large tenants separately before choosing an index.

0

u/AutoModerator 5d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/fragbot2 2d ago

bad bot