title: Improve performance on SQL update from table
body: <p>I'm running a query like the following</p>
  
  <pre><code>update foo f set type=b.type from bar b where f.bar_id = b.id;
  </code></pre>
  
  <p>Each of these tables has several million rows. What I find strange is doing an analyze on this query shows that it runs 2 table scans, rather than using the fact that it's joining on <code>bar</code>s primary key.</p>
  
  <p>Any thoughts on how to make it use the index or otherwise increase the speed?</p>