Anonymous
public text v1 · immutablecreate view listing_point_distance as
select *, sqrt(
pow(latitude - point_latitude, 2) +
pow((longitude - point_longitude) *
cos(point_latitude * pi() / 180), 2)
) * 69.09 as distance
from listing, point order by distance;
mysql> select count(*) from listing_point_distance;
(can't show header, it's outside of the scroll buffer)
| 226015 |
| 226015 |
| 226015 |
| 226015 |
| 226015 |
| 226015 |
| 226015 |
| 226015 |
| 226015 |
<snip>
+----------+
226015 rows in set (0.33 sec)