I have a CSV file with 50000 entries which I want to import in SQL using batch in JDBC.
What should be the optimal batch size for it?
Advertisement
Answer
According to Oracle official recommendations, optimal batch size is between 50 and 100
Proof:
https://docs.oracle.com/cd/E11882_01/java.112/e16548/oraperf.htm#JJDBC28754
Oracle recommends that you use JDBC standard features when possible. This recommendation applies to update batching as well. Oracle update batching is retained primarily for backwards compatibility.
For both standard update batching and Oracle update batching, Oracle recommends you to keep the batch sizes in the general range of 50 to 100. This is because though the drivers support larger batches, they in turn result in a large memory footprint with no corresponding increase in performance. Very large batches usually result in a decline in performance compared to smaller batches.
Have a nice day