[enhancement](jdbc catalog) Add mysql jdbc url param rewriteBatchedStatements=true (#21864)

When `rewriteBatchedStatements=false`, the JDBC driver will not merge multiple insert statements into one larger insert statement. Therefore, during the batch insertion process, each insert statement needs to be sent to the MySQL server individually, leading to a higher number of network roundtrips. Network latency could potentially be a significant factor contributing to the performance degradation. For this reason, we propose to set this parameter to true by default, to enhance the performance of prepared statement batch inserts.
This commit is contained in:
zy-kkk
2023-07-17 17:39:26 +08:00
committed by GitHub
parent 1c36b77024
commit 014b34bebb

View File

@ -303,10 +303,11 @@ public class JdbcResource extends Resource {
// However when tinyInt1isBit=false, GetColumnClassName of MySQL returns java.lang.Boolean,
// while that of Doris returns java.lang.Integer. In order to be compatible with both MySQL and Doris,
// Jdbc params should set tinyInt1isBit=true&transformedBitIsBoolean=true
newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, "tinyInt1isBit", "true", "true");
newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, "transformedBitIsBoolean", "true", "true");
newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, "tinyInt1isBit", "false", "true");
newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, "transformedBitIsBoolean", "false", "true");
// set useUnicode and characterEncoding to false and utf-8
newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, "useUnicode", "false", "true");
newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, "rewriteBatchedStatements", "false", "true");
newJdbcUrl = checkAndSetJdbcParam(newJdbcUrl, "characterEncoding", "utf-8");
if (dbType.equals(OCEANBASE)) {
// set useCursorFetch to true