timescale / pgvectorscale

A complement to pgvector for high performance, cost efficient vector search on large workloads.
PostgreSQL License
1.3k stars 56 forks source link

Support vector distance cutoff queries #123

Open cevian opened 2 months ago

cevian commented 2 months ago

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

Drzhivago264 commented 2 months ago

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.