Whats the fastest way to lookup big tables for points within radius MySQL (latitude longitude)
问题 Currently I have a few tables with 100k+ rows. I am trying to lookup the data like follows. SELECT *, SQRT(POW(69.1 * (latitude - '49.1044302'), 2) + POW(69.1 * ('-122.801094' - longitude) * COS(latitude / 57.3), 2)) AS distance FROM stops HAVING distance < 5 ORDER BY distance limit 100 But currently this method slows with high load. Some queries are taking 20+ seconds to complete. If anyone knows any better ways to optimize this would be great. 回答1: Well first of all if you have a lot of