title: Updating value from other table expensive on large data set
body: <p>I have a table (table1) with 7 million rows and I need to copy one value from that table into a column from a different table (table2). I have tried to do this on a sample table with only 50 rows and it was very expensive (22 seconds). Am I missing something? It's a relatively simple operation and I can't have this take hours/days to run.</p>
  
  <pre><code>postgres=# explain analyze update table2 set myvalue=(SELECT myvalue from table1 t1 where table2.id=t1.id);
  </code></pre>
  
  <h2>                                                                  QUERY PLAN</h2>
  
  <pre><code> Update on table2  (cost=0.00..14291311.70 rows=130 width=586) (actual time=22074.702..22074.702 rows=0 loops=1)
     -&gt;  Seq Scan on table2  (cost=0.00..14291311.70 rows=130 width=586) (actual time=407.754..22073.606 rows=50 loops=1)
           SubPlan 1
             -&gt;  Seq Scan on table1 t1  (cost=0.00..109933.08 rows=4836 width=32) (actual time=264.664..441.460 rows=1 loops=50)
                   Filter: (table2.id = (id)::text)
                   Rows Removed by Filter: 737957
   Planning time: 0.110 ms
   Execution time: 22074.747 ms
  </code></pre>