From 0753bf8baf79727b53f52a09135640d1053286bb Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sat, 14 Sep 2024 20:17:50 +0800 Subject: [PATCH 1/4] sysvars: add tidb_shard_row_id_bits and tidb_pre_split_regions Signed-off-by: Jack Yu --- system-variables.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system-variables.md b/system-variables.md index 1bb95aa4baabb..507494be0d442 100644 --- a/system-variables.md +++ b/system-variables.md @@ -3159,6 +3159,16 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - Range: `[1, 100000]` - This variable controls the maximum number of execution plans that can be cached by [Non-prepared plan cache](/sql-non-prepared-plan-cache.md). +### `tidb_pre_split_regions` New in v8.4.0 + +- Scope: SESSION | GLOBAL +- Persists to cluster: Yes +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No +- Type: Integer +- Default value: `0` +- Range: `[0, 15]` +- This variable is used to set the default row split shards number for newly created tables. When this variable is set to a non-zero value, TiDB will automatically set it when executing CREATE TABLE statements, allowing use of pre_split_regions on such tables (e.g., NONCLUSTERED tables). See [pre_split_regions](/sql-statement-split-region.md) for details. This variable is typically used in conjunction with `tidb_shard_row_id_bits` to shard new tables and split the regions of new tables. + ### tidb_generate_binary_plan New in v6.2.0 > **Note:** @@ -5271,6 +5281,16 @@ SHOW WARNINGS; - Range: `[1, 9223372036854775807]` - This variable controls the maximum number of continuous IDs to be allocated for the [`AUTO_RANDOM`](/auto-random.md) or [`SHARD_ROW_ID_BITS`](/shard-row-id-bits.md) attribute. Generally, `AUTO_RANDOM` IDs or the `SHARD_ROW_ID_BITS` annotated row IDs are incremental and continuous in one transaction. You can use this variable to solve the hotspot issue in large transaction scenarios. +### `tidb_shard_row_id_bits` New in v8.4.0 + +- Scope: SESSION | GLOBAL +- Persists to cluster: Yes +- Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No +- Type: Integer +- Default value: `0` +- Range: `[0, 15]` +- This variable is used to set the shard bits for new table's default row ID. When this variable has a non-zero value, TiDB will automatically set this property when executing CREATE TABLE statements on tables that allow using `shard_row_id_bits` (such as NONCLUSTERED tables). See [SHARD_ROW_ID_BITS](/shard-row-id-bits.md) for details. + ### tidb_simplified_metrics > **Note:** From 6758285ada329c8a0ddffcf45b407ff640868ef0 Mon Sep 17 00:00:00 2001 From: Jack Yu Date: Sat, 14 Sep 2024 20:53:51 +0800 Subject: [PATCH 2/4] fix ci Signed-off-by: Jack Yu --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 507494be0d442..26a38b11974b6 100644 --- a/system-variables.md +++ b/system-variables.md @@ -3167,7 +3167,7 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - Type: Integer - Default value: `0` - Range: `[0, 15]` -- This variable is used to set the default row split shards number for newly created tables. When this variable is set to a non-zero value, TiDB will automatically set it when executing CREATE TABLE statements, allowing use of pre_split_regions on such tables (e.g., NONCLUSTERED tables). See [pre_split_regions](/sql-statement-split-region.md) for details. This variable is typically used in conjunction with `tidb_shard_row_id_bits` to shard new tables and split the regions of new tables. +- This variable is used to set the default row split shards number for newly created tables. When this variable is set to a non-zero value, TiDB will automatically set it when executing CREATE TABLE statements, allowing use of pre_split_regions on such tables (for example NONCLUSTERED tables). See [pre_split_regions](/sql-statements/sql-statement-split-region.md) for details. This variable is typically used in conjunction with `tidb_shard_row_id_bits` to shard new tables and split the regions of new tables. ### tidb_generate_binary_plan New in v6.2.0 From 06046760494a42c80b56de1a04d6ddab01733859 Mon Sep 17 00:00:00 2001 From: xixirangrang Date: Wed, 18 Sep 2024 21:12:34 +0800 Subject: [PATCH 3/4] Apply suggestions from code review --- system-variables.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system-variables.md b/system-variables.md index 26a38b11974b6..d05eb15b24876 100644 --- a/system-variables.md +++ b/system-variables.md @@ -3159,7 +3159,7 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - Range: `[1, 100000]` - This variable controls the maximum number of execution plans that can be cached by [Non-prepared plan cache](/sql-non-prepared-plan-cache.md). -### `tidb_pre_split_regions` New in v8.4.0 +### tidb_pre_split_regions New in v8.4.0 - Scope: SESSION | GLOBAL - Persists to cluster: Yes @@ -3167,7 +3167,7 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - Type: Integer - Default value: `0` - Range: `[0, 15]` -- This variable is used to set the default row split shards number for newly created tables. When this variable is set to a non-zero value, TiDB will automatically set it when executing CREATE TABLE statements, allowing use of pre_split_regions on such tables (for example NONCLUSTERED tables). See [pre_split_regions](/sql-statements/sql-statement-split-region.md) for details. This variable is typically used in conjunction with `tidb_shard_row_id_bits` to shard new tables and split the regions of new tables. +- This variable is used to set the default row split shards number for newly created tables. When this variable is set to a non-zero value, TiDB will automatically set it when executing `CREATE TABLE` statements, allowing use of `PRE_SPLIT_REGIONS` on such tables (for example NONCLUSTERED tables). For more information, see [`PRE_SPLIT_REGIONS`](/sql-statements/sql-statement-split-region.md#pre_split_regions). This variable is typically used in conjunction with [`tidb_shard_row_id_bits`](/system-variables.md#tidb_shard_row_id_bits-new-in-v840) to shard new tables and split the Regions of new tables. ### tidb_generate_binary_plan New in v6.2.0 @@ -5281,7 +5281,7 @@ SHOW WARNINGS; - Range: `[1, 9223372036854775807]` - This variable controls the maximum number of continuous IDs to be allocated for the [`AUTO_RANDOM`](/auto-random.md) or [`SHARD_ROW_ID_BITS`](/shard-row-id-bits.md) attribute. Generally, `AUTO_RANDOM` IDs or the `SHARD_ROW_ID_BITS` annotated row IDs are incremental and continuous in one transaction. You can use this variable to solve the hotspot issue in large transaction scenarios. -### `tidb_shard_row_id_bits` New in v8.4.0 +### tidb_shard_row_id_bits New in v8.4.0 - Scope: SESSION | GLOBAL - Persists to cluster: Yes @@ -5289,7 +5289,7 @@ SHOW WARNINGS; - Type: Integer - Default value: `0` - Range: `[0, 15]` -- This variable is used to set the shard bits for new table's default row ID. When this variable has a non-zero value, TiDB will automatically set this property when executing CREATE TABLE statements on tables that allow using `shard_row_id_bits` (such as NONCLUSTERED tables). See [SHARD_ROW_ID_BITS](/shard-row-id-bits.md) for details. +- This variable is used to set the shard bits for the default row ID of a new table. When this variable has a non-zero value, TiDB will automatically set this property when executing `CREATE TABLE` statements on tables that allow using `SHARD_ROW_ID_BITS` (such as NONCLUSTERED tables). For more information, see [`SHARD_ROW_ID_BITS`](/shard-row-id-bits.md). ### tidb_simplified_metrics From 6c8ac38e0cf21a08372ad0230ba3a5b360aa8608 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Tue, 8 Oct 2024 17:09:58 +0800 Subject: [PATCH 4/4] Refine wording --- system-variables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system-variables.md b/system-variables.md index d05eb15b24876..4f8e947a4746d 100644 --- a/system-variables.md +++ b/system-variables.md @@ -3167,7 +3167,7 @@ For a system upgraded to v5.0 from an earlier version, if you have not modified - Type: Integer - Default value: `0` - Range: `[0, 15]` -- This variable is used to set the default row split shards number for newly created tables. When this variable is set to a non-zero value, TiDB will automatically set it when executing `CREATE TABLE` statements, allowing use of `PRE_SPLIT_REGIONS` on such tables (for example NONCLUSTERED tables). For more information, see [`PRE_SPLIT_REGIONS`](/sql-statements/sql-statement-split-region.md#pre_split_regions). This variable is typically used in conjunction with [`tidb_shard_row_id_bits`](/system-variables.md#tidb_shard_row_id_bits-new-in-v840) to shard new tables and split the Regions of new tables. +- This variable is used to set the default number of row split shards for newly created tables. When this variable is set to a non-zero value, TiDB will automatically apply this attribute to tables that allow the use of `PRE_SPLIT_REGIONS` (for example, `NONCLUSTERED` tables) when executing `CREATE TABLE` statements. For more information, see [`PRE_SPLIT_REGIONS`](/sql-statements/sql-statement-split-region.md#pre_split_regions). This variable is typically used in conjunction with [`tidb_shard_row_id_bits`](/system-variables.md#tidb_shard_row_id_bits-new-in-v840) to shard new tables and pre-split the Regions of new tables. ### tidb_generate_binary_plan New in v6.2.0 @@ -5289,7 +5289,7 @@ SHOW WARNINGS; - Type: Integer - Default value: `0` - Range: `[0, 15]` -- This variable is used to set the shard bits for the default row ID of a new table. When this variable has a non-zero value, TiDB will automatically set this property when executing `CREATE TABLE` statements on tables that allow using `SHARD_ROW_ID_BITS` (such as NONCLUSTERED tables). For more information, see [`SHARD_ROW_ID_BITS`](/shard-row-id-bits.md). +- This variable is used to set the default number of row ID shards for newly created tables. When this variable is set to a non-zero value, TiDB will automatically apply this attribute to tables that allow the use of `SHARD_ROW_ID_BITS` (for example, `NONCLUSTERED` tables) when executing `CREATE TABLE` statements. For more information, see [`SHARD_ROW_ID_BITS`](/shard-row-id-bits.md). ### tidb_simplified_metrics