[postgis-devel] <<->>

Paul Ramsey pramsey at cleverelephant.ca
Thu May 21 11:15:25 PDT 2015


I'm looking at converting this operator to do "true" KNN, just like
<-> now does (for PgSQL 9.5).  A couple things hold me back:

- having to renovate the regression tests to handle testing both pre-
and post-9.5 behaviors conditionally (yuck!)
- the lack of a "true" distance4d function to apply in the case of
GeometryZM and GeometryM inputs. We have support for 2d, and 3dz
inputs, but nothing for others.
  - I could hack something up, that would fuse a true 2d or 3d
distance with a centroid-based distance for the M dimension
  - I could have a hybrid that does centroid distance for 3dm and 3dzm
but true distance for 2d and 3dz.
  - I could do nothing and leave the <<->> operator as it is now

At the same time, the opportunity is there to add a <-> KNN operator
to GEOGRAPHY that does use true distance. The gist hooks might need a
bit of extra code to only recheck when a geography was in play, but
otherwise there shouldn't be any effect on the existing implementation
for <<->>.

Any opinions, particularly for <<->>?

P.



More information about the postgis-devel mailing list