Live data from Hacker News

The Case Against PGVector

alex-jacobs.com

21–30 of 144 posts

Re: The Case Against PGVector

#21

Curious if the author tried the new Redis module that brings HNSW vector search to redis. From what I've seen is fast, has excellent API, and is implemented by a brilliant engineer in the space (Antirez). But not using these things beyond local tests, I can never really hold opinions over those using these systems in production.

It's fast...because everything needs to be in memory. Expect astronomical cloud costs even for mid-sized data requirements.

Re: The Case Against PGVector

#22

    > 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 then complain? Has AWS marketing really confused people into believing that some EC2 "instance size" is an actual server?

Re: The Case Against PGVector

#23

> The problem is that index builds are memory-intensive operations, and Postgres doesn’t have a great way to throttle them. maintenance_work_mem begs to differ. > You rebuild the index periodically to fix this, but during the rebuild (which can take hours for large datasets), what do you do with new inserts? Queue them? Write to a separate unindexed table and merge later? You use REINDEX CONCURRENTLY. > But updating…

some fair points points on the specifics.

> maintenance_work_mem

sure, but the knob existing doesn't solve the operational challenge of safely allocating GBs of RAM on prod for hours-long index builds.

> REINDEX CONCURRENTLY

this is still not free not free—takes longer, needs 2-3x disk space, and still impacts performance.

> HNSW vs B+tree

it's not that graph updates are uniquely expensive. vector workloads have different characteristics than traditional OLTP, and pg wasn't originally designed for them

my broader point: these features exist, but using them correctly requires significant Postgres expertise. my thesis isn't "Postgres lacks features"—it's "most teams underestimate the operational complexity." dedicated vector DBs handle this automatically, and are often going to be much cheaper than the dev time put into maintaining pgvector (esp. for a small team)

Re: The Case Against PGVector

#24

> The problem is that index builds are memory-intensive operations, and Postgres doesn’t have a great way to throttle them. maintenance_work_mem begs to differ. > You rebuild the index periodically to fix this, but during the rebuild (which can take hours for large datasets), what do you do with new inserts? Queue them? Write to a separate unindexed table and merge later? You use REINDEX CONCURRENTLY. > But updating…

> maintenance_work_mem

That kills the indexing process, you cannot let it run with limited amount of memory.

> How do you think a B+tree gets updated?

In a B+Tree, you need to touch log H of the pages. In HNSW graph - you need to touch literally thousands of vectors once your graph gets big enough.

Re: The Case Against PGVector

#25

As others have commented, all the mentioned issues are resolved, I will favour in using the PGVector. If Postgres can be a good choice over Kafka to deliver 100k events/sec [1], then why not PGVector over Chroma or other specialized vector search (unless there is a specific requirement that can't be solved wit minor code/config changes)! [1] Ref: https://news.ycombinator.com/item?id=44659678

how are all of the mentioned issues resolved?

Re: The Case Against PGVector

#26
post #2

Yeah, but just like all other bolt-on databases, now your vital data/biz logic is disconnected from the hot new VC database of the month's logic and you have to write balls of mud to connect it all. That's a very big tradeoff (logic, operations, etc). Furthermore, when all the hipster vector database die or go into maintenance mode or get the license rug-pull when the investors come looking for revenue, postgres will…

> Also, all this vector stuff is going to fade away as context windows get larger (already started over the past 8 months or so). People who say this really have not thought this through, or simply don't understand what the usecases for vector search are. But even if you had infinite context, with perfect attention, attention isn't free. Even if you had linear attention. It's much much cheaper to index your data than…

IMO for some things RAG works great, and for others you may need attention, and hence why the completely disparate experiences about RAG.

As an example, if one is chunking inputs into a RAG, one is basically hardcoding a feature based on locality - which may or may not work. If it works - as in, it is a good feature (the attention matrix is really tail-heavy - LSTMs would work, etc...) - then hey, vector DBs work beautifully. But for many things where people have trouble with RAG, the locality assumption is heavily violated - and there you _need_ the full-on attention matrix.

Re: The Case Against PGVector

#28
post #2

Yeah, but just like all other bolt-on databases, now your vital data/biz logic is disconnected from the hot new VC database of the month's logic and you have to write balls of mud to connect it all. That's a very big tradeoff (logic, operations, etc). Furthermore, when all the hipster vector database die or go into maintenance mode or get the license rug-pull when the investors come looking for revenue, postgres will…

> Anyways, all this vector stuff is going to fade away as context windows get larger (already started over the past 8 months or so).

We're searching across millions of documents, so i doubt it

Re: The Case Against PGVector

#29
When using vectors / embeddings models, I think there's a lot of low hanging fruit to be had with non-massive datasets - your support documentation, your product info, a lot of search use cases. For these, the interface I really want is more like a file system than a database - I want to be able to just write and update documents like a file system and have the indexes update automatically and invisibly.

So basically, I'd love to have my storage provider give me a vector search API, which I guess is what Amazon S3 vectors is supposed to be (https://aws.amazon.com/s3/features/vectors/)?

Curious to hear what experience people have had with this.

Re: The Case Against PGVector

#30
I think these are the salient concerns I've faced at work using pgvector. Especially getting bit by the query planning when filtering -- it's hard to predict when postgres will decide to use pre- vs post-filtering.

As for inserts being difficult, we basically don't see that because we only update the vector store weekly. We're not trying to index rapidly-changing user data, so that's not a big deal for our use case.

Post reply on HN