From f81f7b1808eb7b607ceaf25ad78161bff93ade99 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 13 Nov 2025 17:21:17 +0800 Subject: [PATCH 1/3] Add temp.md --- temp.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 temp.md diff --git a/temp.md b/temp.md new file mode 100644 index 0000000000000..af27ff4986a7b --- /dev/null +++ b/temp.md @@ -0,0 +1 @@ +This is a test file. \ No newline at end of file From 63b942227b866d70cc3e5de5c7af82992e0c6090 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Thu, 13 Nov 2025 17:21:23 +0800 Subject: [PATCH 2/3] Delete temp.md --- temp.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 temp.md diff --git a/temp.md b/temp.md deleted file mode 100644 index af27ff4986a7b..0000000000000 --- a/temp.md +++ /dev/null @@ -1 +0,0 @@ -This is a test file. \ No newline at end of file From f0af3220e0a55874a2488fd04bdeaf368b67adc9 Mon Sep 17 00:00:00 2001 From: qiancai Date: Thu, 13 Nov 2025 17:52:18 +0800 Subject: [PATCH 3/3] add translation --- best-practices/java-app-best-practices.md | 2 +- develop/dev-guide-connection-parameters.md | 2 +- develop/dev-guide-timeouts-in-tidb.md | 4 ++-- system-variables.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/best-practices/java-app-best-practices.md b/best-practices/java-app-best-practices.md index 681cf2a2ef179..70931657a4ccc 100644 --- a/best-practices/java-app-best-practices.md +++ b/best-practices/java-app-best-practices.md @@ -213,7 +213,7 @@ TiDB provides the following MySQL-compatible timeout control parameters. - `wait_timeout`: controls the non-interactive idle timeout for the connection to Java applications. Starting from TiDB v5.4, the default value of `wait_timeout` is `28800` seconds, which is 8 hours. For TiDB versions earlier than v5.4, the default value is `0`, which means the timeout is unlimited. - `interactive_timeout`: controls the interactive idle timeout for the connection to Java applications. The value is 8 hours by default. -- `max_execution_time`: controls the timeout for SQL execution in the connection, only effective for read-only SQL statements. The value is `0` by default, which allows the connection to be infinitely busy, that is, an SQL statement is executed for an infinitely long time. +- `max_execution_time`: controls the timeout for SQL execution in the connection, only effective for `SELECT` statements (including `SELECT ... FOR UPDATE`). The value is `0` by default, which allows the connection to be infinitely busy, that is, an SQL statement is executed for an infinitely long time. However, in an actual production environment, idle connections and SQL statements with excessively long execution time negatively affect databases and applications. To avoid idle connections and SQL statements that are executed for too long, you can configure these two parameters in your application's connection string. For example, set `sessionVariables=wait_timeout=3600` (1 hour) and `sessionVariables=max_execution_time=300000` (5 minutes). diff --git a/develop/dev-guide-connection-parameters.md b/develop/dev-guide-connection-parameters.md index 38a92ad92b190..e2afe056e22f8 100644 --- a/develop/dev-guide-connection-parameters.md +++ b/develop/dev-guide-connection-parameters.md @@ -307,7 +307,7 @@ After it is configured, you can check the monitoring to see a decreased number o #### Timeout-related parameters -TiDB provides two MySQL-compatible parameters to control the timeout: [`wait_timeout`](/system-variables.md#wait_timeout) and [`max_execution_time`](/system-variables.md#max_execution_time). These two parameters respectively control the connection idle timeout with the Java application and the timeout of the SQL execution in the connection; that is to say, these parameters control the longest idle time and the longest busy time for the connection between TiDB and the Java application. Since TiDB v5.4, the default value of `wait_timeout` is `28800` seconds, which is 8 hours. For TiDB versions earlier than v5.4, the default value is `0`, which means the timeout is unlimited. The default value of `max_execution_time` is `0`, which means the maximum execution time of a SQL statement is unlimited. +TiDB provides two MySQL-compatible parameters to control the timeout: [`wait_timeout`](/system-variables.md#wait_timeout) and [`max_execution_time`](/system-variables.md#max_execution_time). These two parameters respectively control the connection idle timeout with the Java application and the timeout of the SQL execution in the connection; that is to say, these parameters control the longest idle time and the longest busy time for the connection between TiDB and the Java application. Since TiDB v5.4, the default value of `wait_timeout` is `28800` seconds, which is 8 hours. For TiDB versions earlier than v5.4, the default value is `0`, which means the timeout is unlimited. The default value of `max_execution_time` is `0`, which means the maximum execution time of a SQL statement is unlimited, and it applies to all `SELECT` statements (including `SELECT ... FOR UPDATE`). The default value of [`wait_timeout`](/system-variables.md#wait_timeout) is relatively large. In scenarios where a transaction starts but is neither committed nor rolled back, you might need a finer-grained control and a shorter timeout to prevent prolonged lock holding. In this case, you can use [`tidb_idle_transaction_timeout`](/system-variables.md#tidb_idle_transaction_timeout-new-in-v760) (introduced in TiDB v7.6.0) to control the idle timeout for transactions in a user session. diff --git a/develop/dev-guide-timeouts-in-tidb.md b/develop/dev-guide-timeouts-in-tidb.md index 0ae9661fad1e4..bd2c3828e7d60 100644 --- a/develop/dev-guide-timeouts-in-tidb.md +++ b/develop/dev-guide-timeouts-in-tidb.md @@ -72,7 +72,7 @@ SQL statements such as `INSERT INTO t10 SELECT * FROM t1` are not affected by GC ## SQL execution timeout -TiDB also provides a system variable (`max_execution_time`, `0` by default, indicating no limit) to limit the execution time of a single SQL statement. Currently, the system variable only takes effect for read-only SQL statements. The unit of `max_execution_time` is `ms`, but the actual precision is at the `100ms` level instead of the millisecond level. +TiDB also provides a system variable (`max_execution_time`, `0` by default, indicating no limit) to limit the execution time of a single SQL statement. Currently, the system variable only takes effect for `SELECT` statements (including `SELECT ... FOR UPDATE`). The unit of `max_execution_time` is `ms`, but the actual precision is at the `100ms` level instead of the millisecond level. ## JDBC query timeout @@ -100,7 +100,7 @@ TiDB provides the following MySQL-compatible timeout control parameters. - **wait_timeout**, controls the non-interactive idle timeout for the connection to Java applications. Since TiDB v5.4, the default value of `wait_timeout` is `28800` seconds, which is 8 hours. For TiDB versions earlier than v5.4, the default value is `0`, which means the timeout is unlimited. - **interactive_timeout**, controls the interactive idle timeout for the connection to Java applications. The value is `8 hours` by default. -- **max_execution_time**, controls the timeout for SQL execution in the connection, only effective for read-only SQL statements. The value is `0` by default, which allows the connection to be infinitely busy, that is, an SQL statement is executed for an infinitely long time. +- **max_execution_time**, controls the timeout for SQL execution in the connection, only effective for `SELECT` statements (including `SELECT ... FOR UPDATE`). The value is `0` by default, which allows the connection to be infinitely busy, that is, an SQL statement is executed for an infinitely long time. However, in a real production environment, idle connections and indefinitely executing SQL statements have a negative effect on both the database and the application. You can avoid idle connections and indefinitely executing SQL statements by configuring these two session-level variables in your application's connection string. For example, set the following: diff --git a/system-variables.md b/system-variables.md index 2ee09421396ec..73ebf8ebc2edc 100644 --- a/system-variables.md +++ b/system-variables.md @@ -727,7 +727,7 @@ This variable is an alias for [`last_insert_id`](#last_insert_id). > **Note:** > -> Before v6.4.0, the `max_execution_time` system variable takes effect on all types of statements. Starting from v6.4.0, this variable only controls the maximum execution time of read-only statements. The precision of the timeout value is roughly 100ms. This means the statement might not be terminated in exact milliseconds as you specify. +> Before v6.4.0, the `max_execution_time` system variable takes effect on all types of statements. Starting from v6.4.0, this variable only controls the maximum execution time of `SELECT` statements. The precision of the timeout value is roughly 100ms. This means the statement might not be terminated in exact milliseconds as you specify.