title: The best size of batched INSERTs in PostgreSQL
body: <p>I have huge table (500 000 000 rows) of two big integers. Both columns are indexed separately. I am doing INSERTs into this table in batch using syntax:</p>
  
  <pre><code>INSERT into table (col1, col2) VALUES(x0, y0), (x1, y1),...;
  </code></pre>
  
  <p>When inserting small number of items (lets say 500) it gives me same time per one item as when inserting larger number of items (lets say 20000). Is this expected behavior? I thought that PostgreSQL would perform some kind of optimization when inserting more values at once. Just note: autocommit is disabled.</p>
  
  <p>Thank you for any advice.</p>