I am confused about when to use executeBatch()
and executeLargeBatch()
.
I went through the Java documents and the only difference I found is:
executeLargeBatch()
should be used when the returned row count may exceedInteger.MAX_VALUE
.
I replaced executeBatch()
with executeLargeBatch()
but haven't found any performance improvements.
Is handling Integer.MAX_VALUE
the only purpose? Is there any performance advantage in one over the other?
Your quoted difference is the difference: executeBatch
returns int[]
to return the counts of each update. executeLargeBatch
returns long[]
to return the counts of each update. Hence the documentation saying to use the latter if the count may exceed the capacity of int
. E.g., they're the batch equivalents of executeUpdate
(returns int
) and executeLargeUpdate
(returns long
).
I wouldn't expect a performance difference of any significance; it's just a matter of not overflowing the int
if you're potentially updating more than 2,147,483,647 rows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With