title: move data from one table to another, postgresql edition
body: <p>I'd like to move some data from one table to another (with a possibly different schema). Straightforward solution that comes into mind is -</p>
  
  <pre><code>start a transaction with serializable isolation level;
  INSERT INTO dest_table SELECT data FROM orig_table,other-tables WHERE &lt;condition&gt;;
  DELETE FROM orig_table USING other-tables WHERE &lt;condition&gt;;
  COMMIT;
  </code></pre>
  
  <p>Now what if the amount of data is rather big, and the <code>&lt;condition&gt;</code> is expensive to compute? In PostgreSQL, a RULE or a stored procedure can be used to delete data on the fly, evaluating condition only once. Which solution is better? Are there other options?</p>