暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Mysql | JDBC批量提交遇到的小坑

testDemo 2018-12-17
372




标签:mysql,rewriteBatchedStatements




Mysql jdbc批处理数据,需要给jdbc连接加上 rewriteBatchedStatements=true默认jdbc是不会开启批处理,即使你在代码中加了 ps.addBatch(); ps.executeBatch();  SQL 依旧是一条一条的执行,并非真正批量提交。


MySQL itself has no real "batch" API for prepared statements. If you add the configuration property "rewriteBatchedStatements=true" to your JDBC connection string for Connector/J, the driver will rewrite batches of prepared INSERTs into multi-value form, and all other forms of statements into multi-statements, which does give a large performance gain (7-10x)






文章转载自testDemo,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论