pg.ddx.io  pgvector/pgvector GitHub issues and pull requests  
help / color / mirror / Atom feed
From: jkatz (@jkatz) <noreply+jkatz@github.com>
To: pgvector/pgvector <noreply+pgvector-pgvector@github.com>
Subject: Re: [pgvector/pgvector] issue #461: Increase max vectors dimension limit for index
Date: Mon, 11 Nov 2024 14:33:52 +0000
Message-ID: <gh-pgvector-pgvector-461-c2468322965@github.com> (raw)
In-Reply-To: <gh-pgvector-pgvector-461@github.com>
References: <gh-pgvector-pgvector-461@github.com>

I think there are a few things - first, that comparison chart linked above is not accurate as of this writing, and I'd state things a little differently.

"WAL support" is directly tied to durability (the `D` of [ACID](https://en.wikipedia.org/wiki/ACID)), meaning that if a transaction is committed, the data is guaranteed to be stored regardless of a system failure. That's a very powerful (if not the most important) guarantee when working with data in a database. As the pgvecto.rs authors demonstrate, there's write-overhead to using that, but that's up to you to decide on what tradeoffs are more important (e.g. I need to store higher dimensional vectors and understand the risks associated to bypassing the PostgreSQL durability mechanism - there are cases where that tradeoff is acceptable). I haven't looked at pgvecto.rs in depth in awhile, so I'm not sure what other ACID tradeoffs there are.

I don't really want to do a "this-or-that" comparison between the two projects, but I'll clarify a few points related to pgvector:

* **Filtering** - [pgvector v0.8.0](https://github.com/pgvector/pgvector/blob/master/CHANGELOG.md#080-2024-10-30) changed a lot around [filtering](https://github.com/pgvector/pgvector?tab=readme-ov-file#filtering) (I'll personally be writing / presenting more about this topic int he coming weeks), and now has the appropriate mechanisms to avoid the "overfiltering" problem.
* **SIMD** - pgvector has supported SIMD through compilation since at least I started with the project almost 2 years ago, primarily through the use of autovectorization and other compiler flags. The v0.7.0 work was on explicit dispatching for x86-64 architecture, but SIMD was already supported
* **Data types** - pgvector introduced `vector`, `halfvec` (fp16), and `sparsevec`, and leverages the upstream data type binary vectors ([`bit`](https://www.postgresql.org/docs/current/datatype-bit.html)). There are branches open for a few others ([`intvec`](https://github.com/pgvector/pgvector/tree/intvec), [`minivec`](https://github.com/pgvector/pgvector/tree/minivec)), with supported dependent on a variety factors (such as your use cases!)

So this comes into the question at hand - what about maximizing limits? Today, while you can use, for example, a cast from `vector` to `halfvec`, yes that can certainly lose information as part of the search and return less than ideal results. However, to understand the best path forward, where it's an existing solution for further development, it'd help to unpack this:

> This dimension limitation is a critical blocker that prevents our organization from using pgvector, forcing us to maintain a separate vector database instead of leveraging our existing PostgreSQL infrastructure. We've evaluated the proposed workarounds like halfvec and quantization, but the reduction in accuracy is unacceptable for our use case. The ability to index higher-dimensional vectors (3072+ dimensions) while maintaining full precision would be transformative for our ability to consolidate on PostgreSQL.

@orentet For example, what is your recall target? What are you currently achieving? How much data are you storing in your index? What does your schema look like? What query patterns do you have? Are you doing any reranking (e.g. searching over the `halfvec` index, then doing a final reordering on the full vector in the table?). Do you have any filters on the data? Understanding details helps to guide what next steps may be.

That said, at [PGConf.eu 2024](https://2024.pgconf.eu/) I had a long discussion with one of the PostgreSQL committers around expanding the buffer/page size for indexes and potential paths forward. First, this would be a very big project (at least what we were discussing), and, at least as discussed, it would create additional configurations on the PostgreSQL side to support embeddings that go past 8KB. But, it would allow for continuance of relying on PostgreSQL storage mechanisms (e.g. durability) for these larger vector types.

Additionally, there may be ways shorter term to achieve storing larger vectors (e.g. page chaining), but that could potentially lead to performance crunches that may make it unsuitable, but it's likely worth the experiment  to try.

view thread (61+ messages)  latest in thread

Message-ID: <gh-pgvector-pgvector-461-c2468322965@github.com>
Permalink:  ../gh-pgvector-pgvector-461-c2468322965@github.com/

 · 


This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox