The mysql jdbc driver has a property called rewriteBatchedStatements that, when set to true can improve batch inserts significantly, but has to be explicitly turned on.
I've had to do this for multiple projects now, and couldnt find any good reason why I must manually turn this on.
Why is this not the default?
The connection property rewriteBatchedStatements provides a non-JDBC compliant feature. Not all statements can be re-written and it may held unexpected results. Particularly with regard to handling errors and returning update counts.
Also note that rewriteBatchedStatements can modify the original SQL string beyond a simple concatenation of queries which, in many cases, is not expected or desirable.
For those reasons, and many others, this property is false by default.
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