City radius and mySQL

I have a form where people can select a city and radius (up to 500 miles), and then I will get all the zip codes for these cities within 500mi (Radius).

Then I would query mySQL like this → http://pastie.org/1670269

Is there a better way to do this? Because sometimes it takes 2 minutes to request.

Hi

+3
source share
1 answer

Try geospatial queries: http://www.scribd.com/doc/2569355/Geo-Distance-Search-with-MySQL

It might also be worth taking a look at using mongo db (if possible), as it does geospatial stuff quite well (and much faster than MySQL): http://www.mongodb.org/display/DOCS/Geospatial+Indexing

+1
source

All Articles