title: Improve performance using geolocation to sort by distance
body: <p>I have to build the structure of a <code>posts</code> table to handle a big number of data (let's say, 1 million of rows) with with notably those two fields:</p>
  
  <ul>
  <li><code>latitude</code></li>
  <li><code>longitude</code></li>
  </ul>
  
  <p>What I'd like to do is <em>optimise the time consumed by read queries, when sorting by distance</em>.</p>
  
  <p>I have chosen this type: <strong>decimal</strong> (precision: 10, scale: 6), thinking it is more precise than <strong>float</strong>, and relevant.</p>
  
  <p>Would it be appropriate to add an index on <code>latitude</code> and an index on <code>longitude</code>?</p>
  
  <p>I'm always scared watching all the operation, such as <code>SIN()</code>, that ORM are performing to build such queries. I'd like to follow the best practices, to be sure it will scale, event with a lot of rows.</p>
  
  <p>Note: If a general solution is not possible, let's say the database is MySQL.</p>
  
  <p>Thanks.</p>