File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,11 @@ TiDB 还提供了一个系统变量来限制单条 SQL 语句的执行时间,
5151
5252## JDBC 查询超时
5353
54- MySQL jdbc 的查询超时设置 ` setQueryTimeout() ` 对 TiDB 不起作用。这是因为现实客户端感知超时时,向数据库发送一个 KILL 命令。但是由于 tidb-server 是负载均衡的,为防止在错误的 tidb-server 上终止连接,tidb-server 不会执行这个 KILL。这时就要用 ` MAX_EXECUTION_TIME ` 实现查询超时的效果。
54+ 从 v6.1.0 起,当 [ ` enable-global-kill ` ] ( /tidb-configuration-file.md#enable-global-kill-从-v610-版本开始引入 ) 配置项为默认值 ` true ` 时,你可以使用 MySQL JDBC 提供的 ` setQueryTimeout() ` 方法来控制查询的超时时间。
55+
56+ > ** 注意:**
57+ >
58+ > 当 TiDB 版本低于 v6.1.0 或 [ ` enable-global-kill ` ] ( /tidb-configuration-file.md#enable-global-kill-从-v610-版本开始引入 ) 为 ` false ` 时,` setQueryTimeout() ` 对 TiDB 不起作用。这是因为查询超时后,客户端会向数据库发送一条 ` KILL ` 命令。但是由于 TiDB 服务是负载均衡的,为防止 ` KILL ` 命令在错误的 TiDB 节点上终止连接,TiDB 不会执行该命令。此时,可以通过设置 ` max_execution_time ` 实现查询超时控制。
5559
5660TiDB 提供了三个与 MySQL 兼容的超时控制参数:
5761
You can’t perform that action at this time.
0 commit comments