title: MySQL select coordinates within range
body: <p>I've in my database 100 000 addresses (that is records). </p>
  
  <p>Each one of them has its own coordinates (latitude and longitude).</p>
  
  <p>Now, given the geo location of the user (latitude and longitude), I want to show on a map only the addresses inside the 5 miles range (using Google maps v3 APIs).</p>
  
  <p>This means that usually only 5 or 6 addresses have to be shown out of the 100 000 addresses.</p>
  
  <p>One solution could be retrieving all the records and apply a formula in Java to calculate the distance of each address and show it only if it's inside the range.</p>
  
  <p>That would be a waste of processing power, because I would need to retrieve all the records, when I only need to show 5 or 6 of them on the map.</p>
  
  <p>How can I solve this problem on the database side (MySQL), in order to return only the addresses in the 5 miles range?</p>