From e75936c029b0e7bc53f82317ef5b12b706dcf8a0 Mon Sep 17 00:00:00 2001 From: Frank945946 Date: Fri, 22 Nov 2024 17:59:21 +0800 Subject: [PATCH 01/10] Update the description the variable "tidb_scatter_region" --- best-practices/high-concurrency-best-practices.md | 2 +- sql-statements/sql-statement-show-variables.md | 2 +- sql-statements/sql-statement-split-region.md | 2 +- system-variables.md | 5 ++--- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/best-practices/high-concurrency-best-practices.md b/best-practices/high-concurrency-best-practices.md index e035418a5cbba..d9ef4f0eb7b02 100644 --- a/best-practices/high-concurrency-best-practices.md +++ b/best-practices/high-concurrency-best-practices.md @@ -233,7 +233,7 @@ When data starts to be written into table `t`, the data is written into the pre- > > The `tidb_scatter_region` global variable affects the behavior of `PRE_SPLIT_REGIONS`. > -> This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `1`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes data before the scattering is completed, which will have a significant impact on write performance. +> This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `GLOBAL`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes data before the scattering is completed, which will have a significant impact on write performance. **Problem two:** diff --git a/sql-statements/sql-statement-show-variables.md b/sql-statements/sql-statement-show-variables.md index 5affcb2047b11..fbf38a26abaaf 100644 --- a/sql-statements/sql-statement-show-variables.md +++ b/sql-statements/sql-statement-show-variables.md @@ -116,7 +116,7 @@ mysql> SHOW GLOBAL VARIABLES LIKE 'tidb%'; | tidb_replica_read | leader | | tidb_retry_limit | 10 | | tidb_row_format_version | 2 | -| tidb_scatter_region | 0 | +| tidb_scatter_region | | | tidb_skip_isolation_level_check | 0 | | tidb_skip_utf8_check | 0 | | tidb_slow_log_threshold | 300 | diff --git a/sql-statements/sql-statement-split-region.md b/sql-statements/sql-statement-split-region.md index 57bc109c7dbfc..3e212edb0d04f 100644 --- a/sql-statements/sql-statement-split-region.md +++ b/sql-statements/sql-statement-split-region.md @@ -361,7 +361,7 @@ When creating a table with the `AUTO_RANDOM` or `SHARD_ROW_ID_BITS` attribute, y > > The value of `PRE_SPLIT_REGIONS` must be less than or equal to that of `SHARD_ROW_ID_BITS` or `AUTO_RANDOM`. -The `tidb_scatter_region` global variable affects the behavior of `PRE_SPLIT_REGIONS`. This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `1`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes the data before the scattering is completed, which will have a significant impact on write performance. +The `tidb_scatter_region` global variable affects the behavior of `PRE_SPLIT_REGIONS`. This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `GLOBAL`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes the data before the scattering is completed, which will have a significant impact on write performance. ### Examples of pre_split_regions diff --git a/system-variables.md b/system-variables.md index b307d4915e642..9d8ce1b57df49 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5227,11 +5227,10 @@ SHOW WARNINGS; - Type: Enumeration - Default value: `""` - Possible values: `""`, `TABLE`, `GLOBAL` -- By default, Regions are split for a new table when it is being created in TiDB. This variable controls the table Region scattering strategy, determining how TiDB scatters Regions after splitting. This applies to the scenario where data need to be written in batches right after the tables are created in batches, because the newly split Regions can be scattered in TiKV directly and do not have to wait to be scheduled by PD. To ensure the continuous stability of writing data in batches, the `CREATE TABLE` statement returns success only after the Regions are successfully scattered. This makes the statement's execution time multiple times longer than that when you disable this variable. Possible value descriptions are as follows: - - `""`: the default value; indicates that TiDB does not scatter table Regions. +- When the SHARD_ROW_ID_BITS and PRE_SPLIT_REGIONS parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. For these Regions, this variable is used to control the scattering strategy after their splitting. TiDB processes the Regions based on the selected scattering strategy.It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the CREATE TABLE statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Possible value descriptions are as follows: + - `""`: the default value; indicating that the Regions of the table will not be scattered after creation. - `TABLE`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables will be scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - `GLOBAL`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `GLOBAL` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. -- Note that if `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` have been set when a table is created, the specified number of Regions are evenly split after the table creation. ### tidb_schema_cache_size New in v8.0.0 From f1520b25732d3f2d5daea5240aaa6d35cff8292e Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Fri, 22 Nov 2024 18:20:47 +0800 Subject: [PATCH 02/10] Apply suggestions from code review Co-authored-by: Benjamin2037 --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 9d8ce1b57df49..44bb24dd4b6dc 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5227,7 +5227,7 @@ SHOW WARNINGS; - Type: Enumeration - Default value: `""` - Possible values: `""`, `TABLE`, `GLOBAL` -- When the SHARD_ROW_ID_BITS and PRE_SPLIT_REGIONS parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. For these Regions, this variable is used to control the scattering strategy after their splitting. TiDB processes the Regions based on the selected scattering strategy.It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the CREATE TABLE statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Possible value descriptions are as follows: +- When the SHARD_ROW_ID_BITS and PRE_SPLIT_REGIONS parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. For these Regions, this variable is used to control the scattering strategy after their splitting. TiDB processes the Regions based on the selected scattering strategy. It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the CREATE TABLE statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Possible value descriptions are as follows: - `""`: the default value; indicating that the Regions of the table will not be scattered after creation. - `TABLE`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables will be scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - `GLOBAL`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `GLOBAL` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. From d82a741269eee95056c8fad15c012077dbf89892 Mon Sep 17 00:00:00 2001 From: Frank945946 <108602632+Frank945946@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:15:45 +0800 Subject: [PATCH 03/10] Update system-variables.md Co-authored-by: Lilian Lee --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 44bb24dd4b6dc..118fdc3f3a6fb 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5227,7 +5227,7 @@ SHOW WARNINGS; - Type: Enumeration - Default value: `""` - Possible values: `""`, `TABLE`, `GLOBAL` -- When the SHARD_ROW_ID_BITS and PRE_SPLIT_REGIONS parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. For these Regions, this variable is used to control the scattering strategy after their splitting. TiDB processes the Regions based on the selected scattering strategy. It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the CREATE TABLE statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Possible value descriptions are as follows: +- When the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: - `""`: the default value; indicating that the Regions of the table will not be scattered after creation. - `TABLE`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables will be scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - `GLOBAL`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `GLOBAL` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. From beb7204fe48b4455868ea82396bdc333a2e4a694 Mon Sep 17 00:00:00 2001 From: Frank945946 <108602632+Frank945946@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:16:24 +0800 Subject: [PATCH 04/10] Update system-variables.md Co-authored-by: Lilian Lee --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 118fdc3f3a6fb..ba994c851a3d5 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5228,7 +5228,7 @@ SHOW WARNINGS; - Default value: `""` - Possible values: `""`, `TABLE`, `GLOBAL` - When the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: - - `""`: the default value; indicating that the Regions of the table will not be scattered after creation. + - `""`: the default value; indicating that the Regions of the table will not be scattered after table creation. - `TABLE`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables will be scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - `GLOBAL`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `GLOBAL` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. From 9da5a9d617575d65447754b5a9543433992c8ed8 Mon Sep 17 00:00:00 2001 From: Frank945946 <108602632+Frank945946@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:16:42 +0800 Subject: [PATCH 05/10] Update best-practices/high-concurrency-best-practices.md Co-authored-by: xixirangrang --- best-practices/high-concurrency-best-practices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/best-practices/high-concurrency-best-practices.md b/best-practices/high-concurrency-best-practices.md index d9ef4f0eb7b02..ef9c8f9961939 100644 --- a/best-practices/high-concurrency-best-practices.md +++ b/best-practices/high-concurrency-best-practices.md @@ -231,7 +231,7 @@ When data starts to be written into table `t`, the data is written into the pre- > **Note:** > -> The `tidb_scatter_region` global variable affects the behavior of `PRE_SPLIT_REGIONS`. +> The [`tidb_scatter_region`](/system-variables.md#tidb_scatter_region) global variable affects the behavior of `PRE_SPLIT_REGIONS`. > > This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `GLOBAL`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes data before the scattering is completed, which will have a significant impact on write performance. From 069a2c49e43f7d8ffa38019b4dd603a4b84aab7f Mon Sep 17 00:00:00 2001 From: Frank945946 <108602632+Frank945946@users.noreply.github.com> Date: Fri, 22 Nov 2024 22:18:00 +0800 Subject: [PATCH 06/10] Update sql-statements/sql-statement-split-region.md Co-authored-by: xixirangrang --- sql-statements/sql-statement-split-region.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-split-region.md b/sql-statements/sql-statement-split-region.md index 3e212edb0d04f..54638150a9f9f 100644 --- a/sql-statements/sql-statement-split-region.md +++ b/sql-statements/sql-statement-split-region.md @@ -361,7 +361,7 @@ When creating a table with the `AUTO_RANDOM` or `SHARD_ROW_ID_BITS` attribute, y > > The value of `PRE_SPLIT_REGIONS` must be less than or equal to that of `SHARD_ROW_ID_BITS` or `AUTO_RANDOM`. -The `tidb_scatter_region` global variable affects the behavior of `PRE_SPLIT_REGIONS`. This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `GLOBAL`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes the data before the scattering is completed, which will have a significant impact on write performance. +The [`tidb_scatter_region`](/system-variables.md#tidb_scatter_region) global variable affects the behavior of `PRE_SPLIT_REGIONS`. This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `GLOBAL`, then TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Otherwise, TiDB writes the data before the scattering is completed, which will have a significant impact on write performance. ### Examples of pre_split_regions From 5962c2c2c893c3d7f0ae1b6959af2a3e54df4180 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Mon, 25 Nov 2024 15:17:05 +0800 Subject: [PATCH 07/10] Apply suggestions from code review Co-authored-by: xixirangrang --- best-practices/high-concurrency-best-practices.md | 2 +- sql-statements/sql-statement-split-region.md | 2 +- system-variables.md | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/best-practices/high-concurrency-best-practices.md b/best-practices/high-concurrency-best-practices.md index ef9c8f9961939..23559639488ea 100644 --- a/best-practices/high-concurrency-best-practices.md +++ b/best-practices/high-concurrency-best-practices.md @@ -233,7 +233,7 @@ When data starts to be written into table `t`, the data is written into the pre- > > The [`tidb_scatter_region`](/system-variables.md#tidb_scatter_region) global variable affects the behavior of `PRE_SPLIT_REGIONS`. > -> This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `GLOBAL`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes data before the scattering is completed, which will have a significant impact on write performance. +> This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `global`, then TiDB will not return the results to the client until all the Regions are split and scattered. Otherwise, TiDB writes data before the scattering is completed, which will have a significant impact on write performance. **Problem two:** diff --git a/sql-statements/sql-statement-split-region.md b/sql-statements/sql-statement-split-region.md index 54638150a9f9f..34bf10422eba1 100644 --- a/sql-statements/sql-statement-split-region.md +++ b/sql-statements/sql-statement-split-region.md @@ -361,7 +361,7 @@ When creating a table with the `AUTO_RANDOM` or `SHARD_ROW_ID_BITS` attribute, y > > The value of `PRE_SPLIT_REGIONS` must be less than or equal to that of `SHARD_ROW_ID_BITS` or `AUTO_RANDOM`. -The [`tidb_scatter_region`](/system-variables.md#tidb_scatter_region) global variable affects the behavior of `PRE_SPLIT_REGIONS`. This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `GLOBAL`, then TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Otherwise, TiDB writes the data before the scattering is completed, which will have a significant impact on write performance. +The [`tidb_scatter_region`](/system-variables.md#tidb_scatter_region) global variable affects the behavior of `PRE_SPLIT_REGIONS`. This variable controls whether to wait for Regions to be pre-split and scattered before returning results after the table creation. If there are intensive writes after creating the table, you need to set the value of this variable to `global`, then TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Otherwise, TiDB writes the data before the scattering is completed, which will have a significant impact on write performance. ### Examples of pre_split_regions diff --git a/system-variables.md b/system-variables.md index ba994c851a3d5..8056e2679f0ca 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5226,11 +5226,11 @@ SHOW WARNINGS; - Applies to hint [SET_VAR](/optimizer-hints.md#set_varvar_namevar_value): No - Type: Enumeration - Default value: `""` -- Possible values: `""`, `TABLE`, `GLOBAL` +- Possible values: `""`, `table`, `global` - When the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: - `""`: the default value; indicating that the Regions of the table will not be scattered after table creation. - - `TABLE`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables will be scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - - `GLOBAL`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `GLOBAL` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. + - `table`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables will be scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. + - `global`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `global` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. ### tidb_schema_cache_size New in v8.0.0 From cc5b824029accff7d6b55cc754ac9cd06a23ad47 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Mon, 25 Nov 2024 15:26:40 +0800 Subject: [PATCH 08/10] Apply suggestions from code review --- system-variables.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-variables.md b/system-variables.md index 8056e2679f0ca..0fc504794573e 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5227,9 +5227,9 @@ SHOW WARNINGS; - Type: Enumeration - Default value: `""` - Possible values: `""`, `table`, `global` -- When the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that since the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable may significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: - - `""`: the default value; indicating that the Regions of the table will not be scattered after table creation. - - `table`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables will be scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. +- When the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that because the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable might significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: + - `""`: the default value; indicates that the Regions of the table are not scattered after table creation. + - `table`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables are scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - `global`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `global` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. ### tidb_schema_cache_size New in v8.0.0 From ac0d84e46c5daf1719586949c78d16c556822932 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Mon, 25 Nov 2024 15:27:32 +0800 Subject: [PATCH 09/10] Update wording --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index 0fc504794573e..d3cccddc2da2c 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5228,7 +5228,7 @@ SHOW WARNINGS; - Default value: `""` - Possible values: `""`, `table`, `global` - When the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that because the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable might significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: - - `""`: the default value; indicates that the Regions of the table are not scattered after table creation. + - `""`: the default value, indicating that the Regions of the table are not scattered after table creation. - `table`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables are scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - `global`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `global` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster. From 46dbfc237e36e8c1d202d93248b29b747bae29f5 Mon Sep 17 00:00:00 2001 From: Lilian Lee Date: Mon, 25 Nov 2024 15:29:28 +0800 Subject: [PATCH 10/10] Apply suggestions from code review --- system-variables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system-variables.md b/system-variables.md index d3cccddc2da2c..1c121740d0eee 100644 --- a/system-variables.md +++ b/system-variables.md @@ -5227,7 +5227,7 @@ SHOW WARNINGS; - Type: Enumeration - Default value: `""` - Possible values: `""`, `table`, `global` -- When the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that because the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable might significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: +- If the `SHARD_ROW_ID_BITS` and `PRE_SPLIT_REGIONS` parameters are set during table creation, then the system automatically splits the table into a specified number of Regions upon successful creation. This variable controls the scattering strategy for these split Regions. TiDB processes the Regions based on the selected scattering strategy. It is important to note that because the table creation operation waits for the scattering process to complete before returning a success status, enabling this variable might significantly increase the execution time of the `CREATE TABLE` statement. Compared to the scenario where this variable is disabled, the execution time could be several times longer. Descriptions of possible values are as follows: - `""`: the default value, indicating that the Regions of the table are not scattered after table creation. - `table`: indicates that if you set the `PRE_SPLIT_REGIONS` or `SHARD_ROW_ID_BITS` attribute when you create a table, in the scenario of pre-splitting multiple Regions, the Regions of these tables are scattered according to the granularity of the tables. However, if you do not set the preceding attribute when you create a table, in the scenario of creating a large number of tables rapidly, it will cause the Regions of these tables to be concentrated on a few TiKV nodes, resulting in an uneven distribution of Regions. - `global`: indicates that TiDB scatters the Regions of newly created tables according to the data distribution of the entire cluster. Especially when creating a large number of tables rapidly, using the `global` option helps prevent Regions from becoming overly concentrated on a few TiKV nodes, ensuring a more balanced distribution of Regions across the cluster.