The existing DB + vector index option seems so obvious to me that I'm worried I'm missing something.
The existing DB + vector index option seems so obvious to me that I'm worried I'm missing something.
For (1), all of the indexing features of a typical RDBMS are overkill for IVF, where the only indexing you need is by IVF bucket, and then you simply sequentially scan and evaluate distances for everything in those buckets.
However, if you want to perform filtering based on other criteria (e.g., filtering based on metadata associated with each vector), then multiple column indexes could be useful with a RDBMS, as you can more efficiently extract just the vectors that meet criteria prior to a sequential scan (e.g., give me all vectors which have a date in the range between X and Y and whose name contains the string "red").
For (2), these algorithms would be inefficient to express in a typical RDBMS. While you can easily encode a graph in a RDBMS, walking the graph sequentially based on criteria is another matter, because each time you'd have to hit the disk (or in-memory cache) to find the next row to look at, then repeat. Latency could be an issue unless it's all in memory, and if it's all in memory, a RDBMS-type representation is overkill versus more simple pointer chasing in memory.
I guess it also depends upon latency / throughput needs (caching in memory on front of a database could help, but a pure in-memory vector index would be faster), persistence / fault tolerance / replication needs (in memory databases would need some kind of persistent store), or update needs (adding/removing vectors, though adding/removing vectors from an IVF or graph-based index becomes non-trivial if you add or remove too many vectors). Traditional databbases that have been around for a while might provide better guarantees on reliability.
(I'm the author of the GPU half of the Faiss library)
I don't see any fundamental reason why the index in Postgres would be slower than a specialized vector database. The query pattern of the vector database is simply a point query using an index, similar to other queries in an OLTP system.
The only limitation I see is scalability. It's not easy to make PostgreSQL distributed, but solutions like Citus exist, making it still possible.
(I'm the author of pgvecto.rs)
The embeddings are not primary data, they're derived from other content and can be recreated if necessary. The vectors will probably be fed or read in bulk by your ML pipeline at times.
I'd say you probably want the primary storage of your embeddings to be file storage like S3 or similar, and then feed them directly into a search engine like Vespa or Elasticsearch.
Every place where I'm deploying vector databases, though, I'm using them as an alternative index just for searches (indexing embedding/id only) and doing the full object value lookup in the RDBMS. It's easier to optimize their vector clustering / sort performance outside the constraints of postgres - which is perhaps why pgvector suffers more under higher load.
Instead with DataStax's Vector Search, we designed a document style API and corresponding clients that give you a Vector Native experience to do CRUD of vector and meta-data as well CRUD of other data models. Here is one client ref for example https://docs.datastax.com/en/astra/astra-db-vector/clients/p...
In this case, you get the robustness of Postgres (which has been around a while) and Faiss (which is one of the most mature vector indexes).
I’m curious about which use cases it enables.
I use txtai in my everyday work. While txtai is open source, I also support a number of consulting projects that are txtai focused. In most cases, I've used SQLite + Faiss for the vector database config paired with an LLM for RAG support.
This setup has worked well and it's what I would start with until it didn't scale.
Pgvector seems to perform very poorly compared to Qdrant: https://nirantk.com/writing/pgvector-vs-qdrant/
But if I was using Qdrant myself I'd treat it like ElasticSearch - I'd denormalize some of my data into it, but I'd still do most of my work in the relational database and treat Qdrant as effectively an external index for my stuff.
Maybe I'm getting hung up on the world "database" here as indicating that you use that instead of an RDBMS, when actually everyone selling a vector database expects you to use it as effectively an external indexing mechanism instead.
Performance, features, and scalability
run a search against ES => hydrate records from postgres
run a search against a vector database => hydrate LLM context from documents
Neither is a primary canonical datastore. Postgres is for ES and S3 is for documents.