mirror of
https://github.com/postgres/postgres.git
synced 2025-12-16 16:42:29 +03:00
Allow GiST distance function to return merely a lower-bound.
The distance function can now set *recheck = false, like index quals. The executor will then re-check the ORDER BY expressions, and use a queue to reorder the results on the fly. This makes it possible to do kNN-searches on polygons and circles, which don't store the exact value in the index, but just a bounding box. Alexander Korotkov and me
This commit is contained in:
@@ -224,6 +224,10 @@ SELECT count(*) FROM radix_text_tbl WHERE t > 'Worth
|
||||
|
||||
SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St ';
|
||||
|
||||
SELECT * FROM gpolygon_tbl ORDER BY f1 <-> '(0,0)'::point LIMIT 10;
|
||||
|
||||
SELECT * FROM gcircle_tbl ORDER BY f1 <-> '(200,300)'::point LIMIT 10;
|
||||
|
||||
-- Now check the results from plain indexscan
|
||||
SET enable_seqscan = OFF;
|
||||
SET enable_indexscan = ON;
|
||||
@@ -437,6 +441,14 @@ EXPLAIN (COSTS OFF)
|
||||
SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St ';
|
||||
SELECT count(*) FROM radix_text_tbl WHERE t ~>~ 'Worth St ';
|
||||
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT * FROM gpolygon_tbl ORDER BY f1 <-> '(0,0)'::point LIMIT 10;
|
||||
SELECT * FROM gpolygon_tbl ORDER BY f1 <-> '(0,0)'::point LIMIT 10;
|
||||
|
||||
EXPLAIN (COSTS OFF)
|
||||
SELECT * FROM gcircle_tbl ORDER BY f1 <-> '(200,300)'::point LIMIT 10;
|
||||
SELECT * FROM gcircle_tbl ORDER BY f1 <-> '(200,300)'::point LIMIT 10;
|
||||
|
||||
-- Now check the results from bitmap indexscan
|
||||
SET enable_seqscan = OFF;
|
||||
SET enable_indexscan = OFF;
|
||||
|
||||
Reference in New Issue
Block a user