Skip to content
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

Support vector distance cutoff queries #123

Open
cevian opened this issue Aug 22, 2024 · 3 comments
Open

Support vector distance cutoff queries #123

cevian opened this issue Aug 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@cevian
Copy link
Collaborator

cevian commented Aug 22, 2024

Right now we only support ORDER BY distance queries. We should add support for WHERE distance <0.6 queries too.

@cevian cevian added the enhancement New feature or request label Aug 22, 2024
@Drzhivago264
Copy link

Drzhivago264 commented Aug 31, 2024

Hello, dont know if I am doing something stupid, but currently I am using this to achieve distance cutoff.

SELECT *, embedding <=> %s as distance FROM server_embeddingdatasetrecord  
WHERE embedding <=> %s < %s AND dataset_id = %s
ORDER BY distance  
LIMIT %s;

Again, if there is anyone there, a better documentation is very helpful for those who dont have much knowledge about sql and vector indexing.

@Mickael-van-der-Beek
Copy link

@Drzhivago264 Instinctively, I would say that your WHERE condition isn't going to use the PGVectorSpace DiskANN index and will have to scan the entire table to find the matching rows.

There might be an index on dataset_id which could pre-filter the rows but that would unrelated to the vectors.

@Mickael-van-der-Beek
Copy link

@cevian I can confirm that this could be very handy indeed. We have a few uses cases where the number of results is undefined and all matching results within a certain distance or similarity should be returned.

We currently have not found a great solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants