title: How to efficiently paginate large datasets with PHP and MySQL?
body: <p>As some of you may know, use of the LIMIT keyword in MySQL does not preclude it from reading the preceding records.</p>
  
  <p>For example: </p>
  
  <pre><code>SELECT * FROM my_table LIMIT 10000, 20;
  </code></pre>
  
  <p>Means that MySQL will still read the first 10,000 records and throw them away before producing the 20 we are after.</p>
  
  <p>So, when paginating a large dataset, high page numbers mean long load times.</p>
  
  <p>Does anyone know of any existing pagination class/technique/methodology that can paginate large datasets in a more efficient way i.e. that does not rely on the LIMIT MySQL keyword?</p>
  
  <p>In PHP if possible as that is the weapon of choice at my company.</p>
  
  <p>Cheers.</p>