For bulk insertion we normally prefer BATCH operation. How exactly is it optimized for faster insertion in jdbc ?
1 Answer
Normally, by reducing network round-trips. If you are going to execute the same statement 100 times with 100 different sets of bind variables, for example, it would be much more efficient to send all 100 sets of bind variables to the database at once and get back all 100 results using a single network round-trip than it would to incur 100 separate network round-trips in order to execute each query sequentially. If you tell the JDBC driver that you want to create a batch, the driver can minimize the number of times it needs to communicate with the database.
4 Comments
INSERT statements but that would be hard to do transparently. You should be able to get conventional path SQL*Loader-like performance just by reducing network round trips and bulk binding the bind variables.