Live data from Hacker News

The Case Against PGVector

alex-jacobs.com

61–70 of 144 posts

Re: The Case Against PGVector

#61
post #38

Earlier quoted context omitted.

The post is a clear example of when YAGNI backfires, because you think YAGNI but then, you actually do need it. I had this experience, the author had this experience, you might as well - the things you think you AGN are actually pretty basic expectations and not luxuries: being able to write vectors real-time without having to run other processes out of band to keep the recall from degrading over time, being able to…

That's not YAGNI backfiring. The point of YAGNI is that you shouldn't over-engineer up front until you've proven that you need the added complexity. If you need vector search against 100,000 vectors and you already have PostgreSQL then pgvector is a great YAGNI solution. 10 million vectors that are changing constantly? Do a bit more research into alternative solutions. But don't go integrating a separate vector datab…

I think the tricky thing here is that the specific things I referred to (real time writes and pushing SQL predicates into your similarity search) work fine at small scale in such a way that you might not actually notice that they're going to stop working at scale. When you have 100,000 vectors, you can write these SQL predicates (return the 5 top hits where category = x and feature = y) and they'll work fine up until one day it doesn't work fine anymore because the vector space has gotten large. So, I suppose it is fair to say this isn't YAGNI backfiring, this is me not recognizing the shape of the problem to come and not recognizing that I do, in fact, need it (to me that feels a lot like YAGNI backfiring, because I didn't think I needed it, but suddenly I do)

Re: The Case Against PGVector

#62

Is there a comprehensive leaderboard like ClickBench but for vector DBs? Something that measures both the qualitative (precision/recall) and quantitative aspects (query perf at 95th/99th percentile, QPS at load, compression ratios, etc.)? ANN-Benchmark exists but it’s algorithm-focused rather than full-stack database testing, so it doesn’t capture real-world ops like concurrent writes, filtering, or resource manageme…

> Is there a comprehensive leaderboard like ClickBench clickbench has 100m rows of data only, which makes it not comprehensive benchmark at all.

check https://github.com/zilliztech/VectorDBBench

Re: The Case Against PGVector

#63

Earlier quoted context omitted.

That's where it's at. I'm using the 1600D vectors from OpenAI models for findsight.ai, stored SuperBit-quantized. Even without fancy indexing, a full scan (1 search vector -> 5M stored vectors), takes less than 40ms. And with basic binning, it's nearly instant.

this is at the expense of precision/recall though isn't it?

Approximate nearest neighbor searches don't cost precision. Just recall.

Re: The Case Against PGVector

#64

> None of the blogs mention that building an HNSW index on a few million vectors > can consume 10+ GB of RAM or more (depending on your vector dimensions and > dataset size). On your production database. While it’s running. For potentially > hours. 10 GB? Oh jolly gosh! That will almost show up as a pixel or two on my metrics dashboard. Who are these people that run production Postgres clusters on tiny hardware and t…

10GB of ram is a pixel? how big is your company?

Re: The Case Against PGVector

#65

Earlier quoted context omitted.

The post is a clear example of when YAGNI backfires, because you think YAGNI but then, you actually do need it. I had this experience, the author had this experience, you might as well - the things you think you AGN are actually pretty basic expectations and not luxuries: being able to write vectors real-time without having to run other processes out of band to keep the recall from degrading over time, being able to…

Many of the concerns in the article could be addressed by standing up a separate PG database that's used exclusively for vector ops and then not using it for your relational data. Then your vector use cases get served from your vector DB and your relational use cases get served from your relational DB. Separating concerns like that doesn't solve the underlying concern but it limits the blast radius so you can operate…

I've always tried to separate transactional databases from those supporting analytical queries if there's going to be any question that there might be contention. The latter often don't need to be real-time or even near-time.

Re: The Case Against PGVector

#66

> What bothers me most: the majority of content about pgvector reads like it was written by someone who spun up a local Postgres instance, inserted 10,000 vectors, ran a few queries, and called it a day. I this taste with most posts about Postgres that don’t come from “how we scaled Postgres to X”. It seems a lot of writers are trying to ride the wave of popularity, creating a ton of noise that can end up as tech deb…

AI + Docker has made it really easy to set up trivial demo systems and write an article about it.

Re: The Case Against PGVector

#67
post #60

I'm still stuck on whether or not vector search (regardless of vendor) is actually the right way to solve the kinds of problems that everyone seems to believe it's great at. BM25 with query rewriting & expansion can do a lot of heavy lifting if you invest any time at all in configuring things to match your problem space. The article touches on FTS engines and hybrid approaches, but I would start there. Figure out whe…

I like lucene and have used it for many years, but sometimes a conceptually close match is what you want. Lucene and friends are fantastic about word matching, fuzzy searches, stem searches, phonetic searches, faceting and more but have nothing for conceptually or semantically close searches (I understand that they recently added new document vector searches). Also vector searches usually always return something which is not ideal in a lot of cases. I like Reciprocal Rank Fusion myself as it gives the best of both worlds. As a fun trick I use duckdb to do RRF with 5million+ documents and get low double-digit ms response time even under load

Re: The Case Against PGVector

#68

Earlier quoted context omitted.

So you’re quantizing and using IVF — what are your recall numbers with actual use cases?

We do have some benchmark number at https://blog.vectorchord.ai/vector-search-over-postgresql-a-... . It varies on different dataset, but most cases it's 2x or more QPS comparing to pgvector's hnsw at same recall.

Your graphs are measuring accuracy [1] (i'm assuming precision?), not recall? My impression is that your approach would miss surfacing potentially relevant candidates, because that is the tradeoff IVF makes for memory optimization. I'd expect that this especially struggles with high dim vectors and large datasets.

[1] https://cdn.hashnode.com/res/hashnode/image/upload/v17434120...

Re: The Case Against PGVector

#69
post #10

My default is basically YAGNI. You should use as few services as possible, and only add something new when there’s issues. If everything is possible in Postgres, great! If not, at least I’ll know exactly what I need from the New Thing.

Databases are hard to swap out when you realize you need a different one.

That's true when you're talking about a generalized rdbms, but if this is an isolated set of tables for embeddings or something and you don't entangle it with everything else, it can be fine. See also, using Postgres as a KV store.

Re: The Case Against PGVector

#70

My default is basically YAGNI. You should use as few services as possible, and only add something new when there’s issues. If everything is possible in Postgres, great! If not, at least I’ll know exactly what I need from the New Thing.

The post is a clear example of when YAGNI backfires, because you think YAGNI but then, you actually do need it. I had this experience, the author had this experience, you might as well - the things you think you AGN are actually pretty basic expectations and not luxuries: being able to write vectors real-time without having to run other processes out of band to keep the recall from degrading over time, being able to…

[deleted]
Post reply on HN