title: Make SELECT with LIMIT and OFFSET on big table fast
body: <p>I have more than 10 million records in a table.</p>
  <pre><code>SELECT * FROM tbl ORDER BY datecol DESC
  LIMIT 10
  OFFSET 999990
  </code></pre>
  <p>Output of <code>EXPLAIN ANALYZE</code> on <a href="http://explain.depesz.com/s/9iee" rel="nofollow noreferrer">explain.depesz.com</a>.<br />
  Executing the above query takes about 10 seconds. How can I make this faster?</p>
  <h3>Update</h3>
  <p>The execution time is reduced half by using a subquery:</p>
  <pre><code>SELECT * FROM tbl where id in 
  (SELECT id FROM tbl ORDER BY datecol DESC LIMIT 10 OFFSET 999990)
  </code></pre>
  <p>Output of <code>EXPLAIN ANALYZE</code> on <a href="http://explain.depesz.com/s/ibV" rel="nofollow noreferrer">explain.depesz.com</a>.</p>