-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[New Feature] support for pgvector extension #16166
Comments
It might be doable. For table (not-index), supported ops are only standard equalities/inequalities. So for storage, it could be straight serialized, and it would automatically sort correctly if range partitioned. Could also support hash partitioning, in which case you don't get inequalities pushed down but could still apply those filters on PG side. For indexes, there are multiple types, but they aren't too different.
YB could implement the indexes by storing in a format where the key is the closest center to that vector. For example, if a scan will probe 2 clusters, it can lookup distinct centers, find the top 2 closest to what the query wants, then do another lookup on the index filtering on It is also possible to INCLUDE the vector column in case you want to be able to do an index only scan. What happens when deletes happen such that a cluster no longer has any vectors? Then the cluster will be permanently missing from the index. That might be undesirable, so one way to avoid that is to pin a row into the index for each center: not clear what mechanism can do that. More visual example: CREATE TABLE t (i int PRIMARY KEY, v vector(2));
INSERT INTO t VALUES (1, '[-5,-1]'), (2, '[-5,1]'), (3, '[5,-1]'), (4, '[5,1]');
CREATE INDEX ON t USING ivfflat (v vector_l2_ops) WITH (lists = 2); -- 2 clusters Index centers should be
where Index should contain
SET ivfflat.probes = 1;
SELECT * FROM t ORDER BY v <-> '[4,1]' LIMIT 1; Use Next, pop Then, lookup matches in the index for |
👍 |
Jira Link: DB-5722
Description
I'm enjoying working with AI, and I also enjoyed working with Yugabyte... but, I'd love to use them together! Someone recently poked the pgvector maintainer to enable support for vectors with enough dimensions to index embedding generated by OpenAI pgvector/pgvector#52 which was latched onto by Supabase supabase/postgres#472 to build an intelligent contextual search for their documentation (see various references below). Is it possible for Yugabyte to support this extension, or would this essentially require rewriting the concept of the extension from scratch?
https://supabase.com/blog/openai-embeddings-postgres-vector
https://www.youtube.com/watch?v=Yhtjd7yGGGA
https://news.ycombinator.com/item?id=34684593
Phase 1 -
Phase 2 -
The text was updated successfully, but these errors were encountered: