I have a piece of code that executes about 500,000 inserts on a database. It’s now done in a loop calling PreparedStatement’s executeUpdate at each iteration. Would it be faster to add all 500,000 inserts to a batch and and call executeBatch just once?
Share
Yes, it will be much faster. make sure you turn autoCommit off first, otherwise you get no performance benefit.