Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why does rewriteBatchedStatements default to false for mysql connector/j?

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?

like image 815
radai Avatar asked Jan 02 '23 23:01

radai


1 Answers

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.

like image 55
FilipeSilva Avatar answered Jan 05 '23 12:01

FilipeSilva