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

github-merge-queue[bot] pushed a commit to branch 
gh-readonly-queue/dev/pr-13620-954136a0c644e3f5b94fdb2544ebbcd1289dc6f9
in repository https://gitbox.apache.org/repos/asf/seatunnel.git

commit 9de33847c1e765de8cae723cd82a45e9412a4e12
Author: Daniel <[email protected]>
AuthorDate: Mon Nov 30 10:33:25 2026 +0000

    [Docs][Connector-V2] Explain PostgreSQL JDBC batch INSERT tuning (#13620)
---
 docs/en/connectors/sink/Jdbc.md | 19 +++++++++++++++++++
 docs/zh/connectors/sink/Jdbc.md | 19 +++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/docs/en/connectors/sink/Jdbc.md b/docs/en/connectors/sink/Jdbc.md
index 7f268d17bc5..f50457f5939 100644
--- a/docs/en/connectors/sink/Jdbc.md
+++ b/docs/en/connectors/sink/Jdbc.md
@@ -682,6 +682,25 @@ The secret_access_key in AWS authentication. Only valid 
for dialect="dsql"
 ### region [String]
 The area where Amazon Aurora DSQL is located. Only valid for dialect="dsql"
 
+## PostgreSQL batch INSERT tuning
+
+For non-XA PostgreSQL batch jobs that use plain INSERT into an existing table, 
measure the pgJDBC URL property `reWriteBatchedInserts=true` with the installed 
driver version. It lets the driver combine compatible batched INSERT statements 
into multi-row statements; it is not a SeaTunnel option or a transaction 
setting. The pgJDBC 42.5.1 default is `false`.
+
+Merge this fragment into the JDBC sink's existing connection and table 
configuration. Preserve its other URL properties, credentials and save modes:
+
+```hocon
+url = "jdbc:postgresql://localhost:5432/example?reWriteBatchedInserts=true"
+generate_sink_sql = true
+enable_upsert = false
+batch_size = 1000
+```
+
+The row count is a measurement starting point. Compare both settings with 
representative row widths, NULLs, Unicode, decimals, time values and binary 
data, and validate the final stored values and partial final batch. Larger 
batches increase client memory and the amount of work in a failed batch; the 
driver may split a batch according to its version and parameter limits.
+
+Restrict this comparison to plain INSERT. Rewriting changes SQL statement 
grouping, so verify any statement-level triggers, generated/default 
expressions, constraints and failure behavior before enabling it. Do not apply 
a plain INSERT result to custom SQL, conflict updates, DELETE, COPY or XA jobs. 
This property does not change SeaTunnel's commit, retry or checkpoint policy, 
and it does not guarantee a speedup for every workload.
+
+See the [pgJDBC connection 
properties](https://jdbc.postgresql.org/documentation/use/#connection-parameters).
 Confirm the property and limits against the installed driver rather than 
assuming that all 42.x versions behave identically.
+
 ## Exactly-once prerequisites
 
 When `is_exactly_once = true`, JDBC Sink uses XA transactions. Before enabling 
it:
diff --git a/docs/zh/connectors/sink/Jdbc.md b/docs/zh/connectors/sink/Jdbc.md
index 45e928fb3ee..598dd494d2c 100644
--- a/docs/zh/connectors/sink/Jdbc.md
+++ b/docs/zh/connectors/sink/Jdbc.md
@@ -677,6 +677,25 @@ AWS IAM 认证中所需要的secret_access_key。 该参考仅适用于 dialect=
 ### region [String]
 Amazon Aurora DSQL 所在的区域。 该参考仅适用于 dialect="dsql"
 
+## PostgreSQL 批量 INSERT 调优
+
+对于使用普通 INSERT 向已有表写入的非 XA PostgreSQL 批任务,可使用已安装的驱动版本实测 pgJDBC URL 属性 
`reWriteBatchedInserts=true`。驱动会将兼容的批量 INSERT 合并为多行语句;该属性不是 SeaTunnel 
配置项,也不是事务设置。pgJDBC 42.5.1 中的默认值为 `false`。
+
+将以下片段合并到 JDBC Sink 已有的连接和表配置中,保留其他 URL 属性、凭据及保存模式:
+
+```hocon
+url = "jdbc:postgresql://localhost:5432/example?reWriteBatchedInserts=true"
+generate_sink_sql = true
+enable_upsert = false
+batch_size = 1000
+```
+
+该行数仅作为实测起点。使用具有代表性的行宽、NULL、Unicode、小数、时间值和二进制数据对照开关,并核对最终落库值及不足一个完整批次的尾批。增大批次会增加客户端内存及一个失败批次涉及的工作量;驱动会根据版本和参数数量限制拆分批次。
+
+此处仅比较普通 INSERT。重写会改变 SQL 语句的分组,启用前应验证语句级触发器、生成列或默认表达式、约束及失败行为。不要将普通 INSERT 
的结果推广到自定义 SQL、冲突更新、DELETE、COPY 或 XA 任务。该属性不改变 SeaTunnel 
的提交、重试或检查点策略,也不保证对所有负载都加速。
+
+参考 [pgJDBC 
连接属性](https://jdbc.postgresql.org/documentation/use/#connection-parameters),以已安装的驱动核对属性和限制,不要假设所有
 42.x 版本的行为相同。
+
 ## Exactly-once 前置条件
 
 `is_exactly_once = true` 时,JDBC Sink 使用 XA 事务。启用前请确认:

Reply via email to