This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 657a34083f7e47b13b3b85a56c1457cc56d53204
Author: zy-kkk <[email protected]>
AuthorDate: Sat Jul 22 11:32:21 2023 +0800

    [enhancement](jdbc catalog) Add sqlserver jdbc url param 
`useBulkCopyForBatchInsert=true` (#22032)
    
    When useBulkCopyForBatchInsert=false, the JDBC driver will not use SQL 
Server's Bulk Copy API for batch insertions. Thus, during the batch insertion 
process, each insert statement needs to be individually sent to the SQL Server, 
leading to a higher number of network roundtrips. Network latency could 
potentially become a significant factor contributing to performance 
degradation. For this reason, we recommend setting this parameter to true by 
default to enhance the performance of Prepa [...]
    
    In this manner, when performing batch insertions, the JDBC driver will send 
all insertion data to SQL Server in one go via the Bulk Copy API, rather than 
sending each insert statement individually. This can significantly reduce the 
number of network roundtrips, thereby improving performance.
    
    Please note that this option is only effective for fully parameterized 
INSERT statements. If your INSERT statement is mixed with other SQL statements, 
or if it contains values specified directly in the statement, then the JDBC 
driver will not use the Bulk Copy API, but instead will use the standard insert 
method.
---
 fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java
index 8a76b2bc34..777a23330c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/JdbcResource.java
@@ -317,6 +317,9 @@ public class JdbcResource extends Resource {
         if (dbType.equals(POSTGRESQL)) {
             newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, 
"useCursorFetch", "false", "true");
         }
+        if (dbType.equals(SQLSERVER)) {
+            newJdbcUrl = checkAndSetJdbcBoolParam(newJdbcUrl, 
"useBulkCopyForBatchInsert", "false", "true");
+        }
         return newJdbcUrl;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to