title: How does MySQL process ORDER BY and LIMIT in a query?
body: <p>I have a query that looks like this:</p>
  
  <p><code>SELECT article FROM table1 ORDER BY publish_date LIMIT 20</code></p>
  
  <p>How does ORDER BY work? Will it order all records, then get the first 20, or will it get 20 records and order them by the <code>publish_date</code> field?</p>
  
  <p>If it's the last one, you're not guaranteed to really get the most recent 20 articles.</p>