title: Slow MySQL limit select
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4481388/why-does-mysql-higher-limit-offset-slow-the-query-down">Why does MYSQL higher LIMIT offset slow the query down?</a>  </p>
  </blockquote>
  
  
  
  <p>My other thread was closed due to it being a duplicate, but the duplicate, did not help me at all so I do not see a reason for closing this one also!</p>
  
  <p>I have a page and I would like to sort posts in it from top to bottom by the amount of votes each post has.</p>
  
  <p>I have millions of records, and the query gets really slow. it takes few good minutes to get the results.</p>
  
  <p>This is fine:</p>
  
  <pre><code>SELECT `id` FROM `table` ORDER BY `votes` LIMIT 0,20;
  </code></pre>
  
  <p>This will take ages:</p>
  
  <pre><code>SELECT `id` FROM `table` ORDER BY `votes` LIMIT 100000,20;
  </code></pre>
  
  <p>I am not even talking about setting it to 1,000,000 and more.</p>
  
  <p>Any ideas on how to make this faster?
  I tried using the code from <a href="https://stackoverflow.com/questions/4481388/why-does-mysql-higher-limit-offset-slow-the-query-down">Why does MYSQL higher LIMIT offset slow the query down?</a>
  But it does not help either.
  Do you guys have any suggestions on how I can achieve the same result but maybe using PHP? or some better query?</p>