Allow GiST distance function to return merely a lower-bound.
Heikki Linnakangas <heikki.linnakangas@iki.fi>
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
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/gist.sgml | modified | +27 −8 |
| src/backend/access/gist/gistget.c | modified | +21 −9 |
| src/backend/access/gist/gistproc.c | modified | +37 −0 |
| src/backend/access/gist/gistscan.c | modified | +5 −0 |
| src/backend/executor/nodeIndexscan.c | modified | +376 −3 |
| src/backend/optimizer/plan/createplan.c | modified | +58 −15 |
| src/backend/utils/adt/geo_ops.c | modified | +27 −0 |
| src/include/access/genam.h | modified | +3 −0 |
| src/include/access/relscan.h | modified | +9 −0 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_amop.h | modified | +2 −0 |
| src/include/catalog/pg_amproc.h | modified | +2 −0 |
| src/include/catalog/pg_operator.h | modified | +6 −2 |
| src/include/catalog/pg_proc.h | modified | +4 −0 |
| src/include/nodes/execnodes.h | modified | +20 −0 |
| src/include/nodes/plannodes.h | modified | +8 −2 |
| src/include/utils/geo_decls.h | modified | +3 −0 |
| src/test/regress/expected/create_index.out | modified | +78 −0 |
| src/test/regress/sql/create_index.sql | modified | +12 −0 |