I think that queries like this: select * from test where val <-> 500 < 1 order by val <-> 500; can also be optimized using knngist. In case of btree_gist this query can be easily rewritten: select * from test where val > 499 and val < 501 order by val <-> 500; But, in pg_trgm it makes it possible to combine different similarity levels in one query. For example: select * from test_trgm order by t <-> 'asdf' < 0.5 or t <-> 'qwer' < 0.4; Is there any chance to handle this syntax also?
---- With best regards, Alexander Korotkov.