Bookmark Topic Watch Topic
 
friki data migration
Ranch Hand
Posts: 772
1
  • Mark post as helpful
  • send pies
  • Report post to moderator
Avoid inserting lots of records one by one

JDBC knows batching, and you should use it. Do not INSERT thousands of records one by one, re-creating a new PreparedStatement every time. If all of your records go to the same table, create a batch INSERT statement with a single SQL statement and multiple bind value sets. Depending on your database and database configuration, you may need to commit after a certain amount of inserted records, in order to keep the UNDO log slim.

The Cure:

Always batch-insert large sets of data.

Source


SqlBestPractices
 
    Bookmark Topic Watch Topic
  • New Topic