1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-20 15:22:23 +03:00

llow negative coordinate for ~> (cube, int) operator

~> (cube, int) operator was especially designed for knn-gist search.
However, knn-gist supports only ascending ordering of results. Nevertheless
it would be useful to support descending ordering by ~> (cube, int) operator.
We provide workaround for that: negative coordinate give us inversed value
of corresponding cube bound. Therefore, knn search using negative coordinate
gives us an effect of descending ordering by cube bound.

Author: Alexander Korotkov
Reviewed by: Tomas Vondra, Andrey Borodin
Discussion: https://www.postgresql.org/message-id/flat/a9657f6a-b497-36ff-e56-482a2c7e3292@2ndquadrant.com
This commit is contained in:
Teodor Sigaev
2018-01-11 14:49:36 +03:00
parent 563a053bdd
commit f50c80dbb1
5 changed files with 379 additions and 14 deletions

View File

@ -189,8 +189,9 @@
Get <replaceable>n</replaceable>-th coordinate of cube in following way:
n = 2 * k - 1 means lower bound of <replaceable>k</replaceable>-th
dimension, n = 2 * k means upper bound of
<replaceable>k</replaceable>-th dimension. This operator is designed
for KNN-GiST support.
<replaceable>k</replaceable>-th dimension. Negative
<replaceable>n</replaceable> denotes inversed value of corresponding
positive coordinate. This operator is designed for KNN-GiST support.
</entry>
</row>