I came across this set of symbols in an Advanced SQL (postgresql) course video by Torsten Grust: https://youtu.be/WPhU74hmtRw?t=1197
It is in the ORDER BY portion of the query: ORDER BY p.point, p.loc <-> k.mean) AS assign
He explains the meaning, "the minimum distance between one point from another", and I have looked for documentation or other samples, but could not find any. Can anyone point me in the right direction?
CodePudding user response:
the <->
operator in postgresql is a custom operator defined by the PostGIS extension, see it's documentation. Basically:
The <-> operator returns the 2D distance between two geometries. Used in the "ORDER BY" clause provides index-assisted nearest-neighbor result sets. For PostgreSQL below 9.5 only gives centroid distance of bounding boxes and for PostgreSQL 9.5 , does true KNN distance search giving true distance between geometries, and distance sphere for geographies.