title: Tips on Speeding up JDBC writes?
body: <p>I am writing a program that does a lot of writes to a Postgres database.  In a typical scenario I would be writing say 100,000 rows to a table that's well normalized (three foreign integer keys, the combination of which is the primary key and the index of the table).  I am using PreparedStatements and executeBatch(), yet I can only manage to push in say 100k rows in about 70 seconds on my laptop, when the embedded database we're replacing (which has the same foreign key constraints and indices) does it in 10.</p>
  
  <p>I am new at JDBC and I don't expect it to beat a custom embedded DB, but I was hoping it to be only 2-3x slower, not 7x.  Anything obvious that I maybe missing? does the order of the writes matter? (i.e. say if it's not the order of the index?).  Things to look at to squeeze out a bit more speed?</p>