On Mon, Dec 15, 2014 at 4:12 PM, Heikki Linnakangas <hlinnakan...@vmware.com > wrote: > > On 12/15/2014 08:37 AM, Michael Paquier wrote: > >> On Mon, Dec 15, 2014 at 3:09 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> >>> Michael Paquier <michael.paqu...@gmail.com> writes: >>> >>>> - Point to polygon distance operator >>>> >>> I looked at that briefly during the last fest, but was unsure whether it >>> was too entangled with the GiST patches that Heikki was looking at. >>> >> Recalling my memories of this morning, things are rather independent. >> > > Right. I also looked at it briefly, but I wasn't sure if we really want > it. AFAICT, no-one has actually asked for that operator, it was written > only to be an example of an operator that would benefit from the knn-gist > with recheck patch. If there is some other, real, use for the knn-gist with > recheck patch, then I'm OK with that, but otherwise it's dubious to add an > operator just so that it can then be made faster by another patch. That > said, it seems quite harmless, so might as well commit it.
Lack of recheck is major limitation of KNN-GiST now. People are not asking for that because they don't know what is needed to implement exact KNN for PostGIS. Now they have to invent kluges like this: WITH closest_candidates AS ( SELECT streets.gid, streets.name, streets.geom FROM nyc_streets streets ORDER BY streets.geom <-> 'SRID=26918;POINT(583571.905921312 4506714.34119218)'::geometry LIMIT 100 ) SELECT gid, name FROM closest_candidates ORDER BY ST_Distance( geom, 'SRID=26918;POINT(583571.905921312 4506714.34119218)'::geometry ) LIMIT 1; See blog posts: http://blog.light42.com/wordpress/?p=102 http://workshops.boundlessgeo.com/postgis-intro/knn.html ------ With best regards, Alexander Korotkov.