From 54c26ce9bb99f6d2385f58958e82c3fd5514e851 Mon Sep 17 00:00:00 2001 From: doc-claw-bot Date: Fri, 21 Aug 2026 10:06:24 +0000 Subject: [PATCH 1/4] docs: add memory unit example for tidb_server_memory_limit --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 04cd42552715c..3ffc6674ce649 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5815,7 +5815,7 @@ SHOW WARNINGS; - Default value: `80%` - Range: - You can set the value in the percentage format, which means the percentage of the memory usage relative to the total memory. The value range is `[1%, 99%]`. - - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is supported. `0` means no memory limit. + - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is supported. For example, you can set this variable to `90GiB`. `0` means no memory limit. - If this variable is set to a memory size that is less than 512 MiB but not `0`, TiDB uses 512 MiB as the actual size. - This variable specifies the memory limit for a TiDB instance. When the memory usage of TiDB reaches the limit, TiDB cancels the currently running SQL statement with the highest memory usage. After the SQL statement is successfully canceled, TiDB tries to call Golang GC to immediately reclaim memory to relieve memory stress as soon as possible. - Only the SQL statements with more memory usage than the [`tidb_server_memory_limit_sess_min_size`](/system-variables.md#tidb_server_memory_limit_sess_min_size-new-in-v640) limit are selected as the SQL statements to be canceled first. From d3d41dc2b3e5e3bbc7576a86c1880f7cf16a10cc Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Fri, 21 Aug 2026 18:36:53 +0800 Subject: [PATCH 2/4] Apply suggestion from @qiancai --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 3ffc6674ce649..5af40fe417ba8 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5815,7 +5815,7 @@ SHOW WARNINGS; - Default value: `80%` - Range: - You can set the value in the percentage format, which means the percentage of the memory usage relative to the total memory. The value range is `[1%, 99%]`. - - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is supported. For example, you can set this variable to `90GiB`. `0` means no memory limit. + - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is supported. For example, you can set this variable to `90GiB` (no space between the number and the unit). `0` means no memory limit. - If this variable is set to a memory size that is less than 512 MiB but not `0`, TiDB uses 512 MiB as the actual size. - This variable specifies the memory limit for a TiDB instance. When the memory usage of TiDB reaches the limit, TiDB cancels the currently running SQL statement with the highest memory usage. After the SQL statement is successfully canceled, TiDB tries to call Golang GC to immediately reclaim memory to relieve memory stress as soon as possible. - Only the SQL statements with more memory usage than the [`tidb_server_memory_limit_sess_min_size`](/system-variables.md#tidb_server_memory_limit_sess_min_size-new-in-v640) limit are selected as the SQL statements to be canceled first. From da898695ded508d9fe769f8fe7a41a7bf5f9a4db Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 25 Aug 2026 17:03:40 +0800 Subject: [PATCH 3/4] Update system-variables.md --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 5af40fe417ba8..9befd3bb9c71f 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5815,7 +5815,7 @@ SHOW WARNINGS; - Default value: `80%` - Range: - You can set the value in the percentage format, which means the percentage of the memory usage relative to the total memory. The value range is `[1%, 99%]`. - - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is supported. For example, you can set this variable to `90GiB` (no space between the number and the unit). `0` means no memory limit. + - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is also supported. For example, you can set this variable to `90GiB` (no space between the number and the unit). `0` means no memory limit. - If this variable is set to a memory size that is less than 512 MiB but not `0`, TiDB uses 512 MiB as the actual size. - This variable specifies the memory limit for a TiDB instance. When the memory usage of TiDB reaches the limit, TiDB cancels the currently running SQL statement with the highest memory usage. After the SQL statement is successfully canceled, TiDB tries to call Golang GC to immediately reclaim memory to relieve memory stress as soon as possible. - Only the SQL statements with more memory usage than the [`tidb_server_memory_limit_sess_min_size`](/system-variables.md#tidb_server_memory_limit_sess_min_size-new-in-v640) limit are selected as the SQL statements to be canceled first. From 0769740a28aa91c1f2177dc0139922b2c620247a Mon Sep 17 00:00:00 2001 From: qiancai Date: Tue, 25 Aug 2026 17:25:24 +0800 Subject: [PATCH 4/4] docs: add session memory limit unit example --- system-variables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-variables.md b/system-variables.md index 9befd3bb9c71f..46d95dc9c36f8 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5815,7 +5815,7 @@ SHOW WARNINGS; - Default value: `80%` - Range: - You can set the value in the percentage format, which means the percentage of the memory usage relative to the total memory. The value range is `[1%, 99%]`. - - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is also supported. For example, you can set this variable to `90GiB` (no space between the number and the unit). `0` means no memory limit. + - You can also set the value in memory size. The value range is `0` and `[536870912, 9223372036854775807]` in bytes. Memory formats with the units "KiB|MiB|GiB|TiB" or "KB|MB|GB|TB" are also supported. For example, you can set this variable to `90GiB` (no space between the number and the unit). `0` means no memory limit. - If this variable is set to a memory size that is less than 512 MiB but not `0`, TiDB uses 512 MiB as the actual size. - This variable specifies the memory limit for a TiDB instance. When the memory usage of TiDB reaches the limit, TiDB cancels the currently running SQL statement with the highest memory usage. After the SQL statement is successfully canceled, TiDB tries to call Golang GC to immediately reclaim memory to relieve memory stress as soon as possible. - Only the SQL statements with more memory usage than the [`tidb_server_memory_limit_sess_min_size`](/system-variables.md#tidb_server_memory_limit_sess_min_size-new-in-v640) limit are selected as the SQL statements to be canceled first. @@ -5844,7 +5844,7 @@ SHOW WARNINGS; - Persists to cluster: Yes - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Default value: `134217728` (which is 128 MiB) -- Range: `[128, 9223372036854775807]`, in bytes. The memory format with the units "KiB|MiB|GiB|TiB" is also supported. +- Range: `[128, 9223372036854775807]`, in bytes. Memory formats with the units "KiB|MiB|GiB|TiB" or "KB|MB|GB|TB" are also supported. For example, you can set this variable to `90GiB` (no space between the number and the unit). - After you enable the memory limit, TiDB will terminate the SQL statement with the highest memory usage on the current instance. This variable specifies the minimum memory usage of the SQL statement to be terminated. If the memory usage of a TiDB instance that exceeds the limit is caused by too many sessions with low memory usage, you can properly lower the value of this variable to allow more sessions to be canceled. ### tidb_service_scope New in v7.4.0