mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Add support for <-> (box, point) operator to GiST box_ops
Index-based calculation of this operator is exact. So, signature of gist_bbox_distance() function is changes so that caller is responsible for setting *recheck flag. Discussion: https://postgr.es/m/f71ba19d-d989-63b6-f04a-abf02ad9345d%40postgrespro.ru Author: Nikita Glukhov Reviewed-by: Tom Lane, Alexander Korotkov
This commit is contained in:
@@ -109,6 +109,22 @@ select b from gist_tbl where b <@ box(point(5,5), point(6,6));
|
||||
-- execute the same
|
||||
select b from gist_tbl where b <@ box(point(5,5), point(6,6));
|
||||
|
||||
-- Also test an index-only knn-search
|
||||
explain (costs off)
|
||||
select b from gist_tbl where b <@ box(point(5,5), point(6,6))
|
||||
order by b <-> point(5.2, 5.91);
|
||||
|
||||
select b from gist_tbl where b <@ box(point(5,5), point(6,6))
|
||||
order by b <-> point(5.2, 5.91);
|
||||
|
||||
-- Check commuted case as well
|
||||
explain (costs off)
|
||||
select b from gist_tbl where b <@ box(point(5,5), point(6,6))
|
||||
order by point(5.2, 5.91) <-> b;
|
||||
|
||||
select b from gist_tbl where b <@ box(point(5,5), point(6,6))
|
||||
order by point(5.2, 5.91) <-> b;
|
||||
|
||||
drop index gist_tbl_box_index;
|
||||
|
||||
-- Test that an index-only scan is not chosen, when the query involves the
|
||||
|
||||
Reference in New Issue
Block a user