I found this question and am wondering, is it for PostgreSQL? Where’s the documentation for <->? Trying to find the fastest way to get the distance between a lat and long earth coordinates in Redshift.


1 Answer 1


You'll find an exhaustive overview of supported operators in the PostGIS Function reference under Operators.

The more or less canonically named spatial (K)NN operator <-> is documented under Distance operators.

Note that this is an extension to the core distance operator shipped with PostgreSQL. This and its sibling operators are implemented with conditional access a to a suitable index (supporting (K)NN traversal) if put into the ORDER BY clause - and only this implementation detail is the primary performance advantage over plain distance functions!

For spatial distances in the PostGIS extension environment, the operator either returns 2D cartesian distances (GEOMETRY) or spherical (great-circle) distances (GEOGRAPHY).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.