-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
enhancementNew feature or requestNew feature or requestplannerRelated to the query plannerRelated to the query plannerrelationalissues related to relational FDBissues related to relational FDB
Description
Now that HNSW-backed vector indexes are implemented and functional, we should add native support for planning Approximate Nearest Neighbor (ANN) queries in SQL, here is an example for performing efficient K-nearest neighbor searches through SQL:
SELECT docId, title, euclidean_distance(embedding, CAST([1.0, 0.0, 0.0] AS VECTOR(3, HALF))) AS distance
FROM documents
WHERE zone = 'zone1' AND bookshelf = 'fiction'
AND ROW_NUMBER() OVER (
PARTITION BY zone, bookshelf
ORDER BY euclidean_distance(embedding, CAST([1.0, 0.0, 0.0] AS VECTOR(3, HALF))) ASC
) <= 3Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestplannerRelated to the query plannerRelated to the query plannerrelationalissues related to relational FDBissues related to relational FDB