title: psycopg2 COPY using cursor.copy_from() freezes with large inputs
body: <p>Consider the following code in Python, using psycopg2 <code>cursor</code> object (Some column names were changed or omitted for clarity):</p>
  
  <pre><code>filename='data.csv'
  file_columns=('id', 'node_id', 'segment_id', 'elevated', 
                'approximation', 'the_geom', 'azimuth')
  self._cur.copy_from(file=open(filename),
                      table=self.new_table_name, columns=file_columns)
  </code></pre>
  
  <ul>
  <li>The database is located on a remote machine on a fast LAN.</li>
  <li>Using <code>\COPY</code> from bash works very fast, even for large (~1,000,000 lines) files.</li>
  </ul>
  
  <p>This code is ultra-fast for 5,000 lines, but when <code>data.csv</code> grows beyond 10,000 lines, the program freezes completely.</p>
  
  <p>Any thoughts \ solutions?</p>
  
  <p>Adam</p>