We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mariadb驱动batchMultiSend参数默认值为true,该参数官方解释是:
从1.5.0开始,“ useBatchMultiSend”选项允许按批发送查询。 如果禁用,查询将一一发送,等待结果再发送下一个。 如果启用,查询将按与useBatchMultiSendNumber选项的值(默认为100)相对应的批次发送。一段时间后将读取结果,避免了客户端和服务器不在同一主机上时的大量网络延迟。具体参考https://mariadb.com/kb/en/option-batchmultisend-description/
但是mycat不支持一次性处理多个sql报文,必现一个一个处理。
为了支持该需求,设计如下:
该方案仅仅是语法上面支持batchMultiSend=true,并没有达到因为使用batchMultiSend性能变快的效果。
The text was updated successfully, but these errors were encountered:
private static void testMariadbBatchUpdate() { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try { Class.forName("org.mariadb.jdbc.Driver"); conn = DriverManager.getConnection( "jdbc:mariadb://127.0.0.1:8066/TESTDB?rewriteBatchedStatements=false&useBatchMultiSend=true&user=root&password=123"); pstmt = conn.prepareStatement("update customer set name=? where id=?"); long time = System.currentTimeMillis(); for (int i = 0; i < 50; i++) { pstmt.setString(1, String.valueOf(i)); pstmt.setString(2, String.valueOf(i * 2)); pstmt.addBatch(); } pstmt.executeBatch(); System.out.println("batch update end" + (System.currentTimeMillis() - time)); } catch (Exception e) { e.printStackTrace(); } }
测试代码如上。
因为目前采取的是伪支持方式,batchMultiSend为true 对比false时性能相当。
Sorry, something went wrong.
Merge pull request #2563 from funnyAnt/isssue#2542
5e1189d
#2542 支持mariadb驱动useBatchMultiSend=true
No branches or pull requests
需求来源
mariadb驱动batchMultiSend参数默认值为true,该参数官方解释是:
但是mycat不支持一次性处理多个sql报文,必现一个一个处理。
方案
为了支持该需求,设计如下:
缺陷
该方案仅仅是语法上面支持batchMultiSend=true,并没有达到因为使用batchMultiSend性能变快的效果。
The text was updated successfully, but these errors were encountered: