Performance of batches with Statements and PreparedStatements

From: Jeff Kolesky <jeff(at)edusoft(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Performance of batches with Statements and PreparedStatements
Date: 2003-04-08 19:47:26
Message-ID: a05200f02bab8d618e684@[192.168.1.9]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I have some code that is inserting many rows into the database,
executing Statements repeatedly. I can run the inserts as batches
using the JDBC batch functionality, or I can concatenate the inserts
with semi-colons and execute one large statement.

If I take the semi-colon approach, I cannot use a PreparedStatement
easily, which is fine. I read somewhere that the implementation of
executeBatch() just executes all of the statements one-by-one, which
would be as slow as executing separate statements.

I would like some advice as to which method would run faster and if
using PreparedStatements is a good performance boost.

Is there any limit to the number of statements that can be executed in a batch?

All advice is greatly appreciated.

Thanks.

Jeff

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Peter Royal 2003-04-08 22:13:22 Index metadata not sorted by ORDINAL_POSITION
Previous Message Dave Cramer 2003-04-08 18:33:11 Re: JDBC