Distance Operations

The distance operator <-> for set and span types consider the bounding span and returns the smallest distance between the two values. The distance has the type of the difference of two values, as the PostgreSQL minus operator answers it: the base type for numbers, the number of days as an integer for dates, and an interval for timestamps. The distance operator can also be used for nearest neighbor searches using a GiST or an SP-GiST index (see the section called “Indexing”).