title: PostgreSQL temporary tables
body: <p>I need to perform a query 2.5 million times. This query generates some rows which I need to <code>AVG(column)</code> and then use this <code>AVG</code> to filter the table from all values below average. I then need to <code>INSERT</code> these filtered results into a table. </p>
  
  <p>The only way to do such a thing with reasonable efficiency, seems to be by creating a <code>TEMPORARY TABLE</code> for each query-postmaster python-thread. I am just hoping these <code>TEMPORARY TABLE</code>s will not be persisted to hard drive (at all) and will remain in memory (RAM), unless they are out of working memory, of course.</p>
  
  <p>I would like to know if a TEMPORARY TABLE will incur disk writes (which would interfere with the INSERTS, i.e. slow to whole process down)</p>