title: SELECT vs UPDATE performance with index
body: <p>If I <code>SELECT</code> IDs then <code>UPDATE</code> using those IDs, then the <code>UPDATE</code> query is faster than if I would <code>UPDATE</code> using the conditions in the <code>SELECT</code>.</p>
  
  <p>To illustrate:</p>
  
  <pre><code>SELECT id FROM table WHERE a IS NULL LIMIT 10; -- 0.00 sec
  UPDATE table SET field = value WHERE id IN (...); -- 0.01 sec
  </code></pre>
  
  <p>The above is about 100 times faster than an <code>UPDATE</code> with the same conditions:</p>
  
  <pre><code>UPDATE table SET field = value WHERE a IS NULL LIMIT 10; -- 0.91 sec
  </code></pre>
  
  <p>Why?</p>
  
  <p>Note: the <code>a</code> column <em>is</em> indexed.</p>