有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java MySQL Connector/J ClientPreparedStatement#executeBatchInternal中“选项设置成本”注释的含义是什么?

Env:mysql连接器java 8.0.19

我注意到,当我使用PreparedStament执行一些批处理操作时,在com.mysql.cj.jdbc.ClientPreparedStatement#executeBatchInternal源代码中有一条注释说“选项设置rt-wise的成本”。MySQL Connector/J的源代码片段如下:

if (!this.batchHasPlainStatements && this.rewriteBatchedStatements.getValue()) {
    if (((PreparedQuery<?>) this.query).getParseInfo().canRewriteAsMultiValueInsertAtSqlLevel()) {
        return executeBatchedInserts(batchTimeout);
    }

    if (!this.batchHasPlainStatements && this.query.getBatchedArgs() != null
            && this.query.getBatchedArgs().size() > 3 /* cost of option setting rt-wise */) {
        return executePreparedBatchAsMultiStatement(batchTimeout);
    }
}

因此,我的问题是:

  1. “期权设定成本”这句话的确切含义是什么
  2. 为什么MySQL Connector/J选择3作为重写批处理语句的底线,为什么不选择4或其他数字

谢谢


共 (0) 个答案