From 86af68138a987c52647cf175bec3d4ae98020c28 Mon Sep 17 00:00:00 2001 From: JoyinQin <56883733+Joyinqin@users.noreply.github.com> Date: Mon, 14 Sep 2020 19:41:12 +0800 Subject: [PATCH 1/7] add system variable 'tidb_enable_clustered_index' for v5.0 --- system-variables.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/system-variables.md b/system-variables.md index ce961bc2befcb..cb927f138c037 100644 --- a/system-variables.md +++ b/system-variables.md @@ -285,6 +285,22 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: 0 - This variable is used to control whether to enable the cascades planner, which is currently considered experimental. +### `tidb_enable_clustered_index` New in 5.0 + +- Scope: SESSION | GLOBAL +- Default value: 1 +- This variable is used to control whether to enable the Clustered Index feature. + - This feature is only applicable to newly created tables and will not affect old tables that have been created. + - This feature is only applicable to tables of single column non-integer primary key and multi-column primary key. It does not affect tables without primary keys and tables with single column integer primary keys. + - You can execute `select tidb_pk_type from information_schema.tables where table_name ='{table_name}'` to check whether a table uses the Clustered Index feature. +- After you enable the feature, rows are stored directly on the primary key instead of the rows_ID allocated within the system, and use the extra created primary key index to point to row_id. + + The impact of this variable on performance is mainly reflected in the following aspects: + - When inserting this variable, each row reduces the write of one index key. + - When using the primary key as the equivalent condition query, you can save one read request. + - When using a single-column primary key as a range condition query, you can save multiple read requests. + - When using the prefix of a multi-column primary key as an equivalent or range condition query, you can save multiple read requests. + ### tidb_enable_chunk_rpc New in v4.0 - Scope: SESSION From 5a6d084bb729ac511acc42172b4aea5e27b77a4c Mon Sep 17 00:00:00 2001 From: JoyinQin <56883733+Joyinqin@users.noreply.github.com> Date: Tue, 15 Sep 2020 09:55:45 +0800 Subject: [PATCH 2/7] improve language --- system-variables.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-variables.md b/system-variables.md index cb927f138c037..5617cdb0d12d2 100644 --- a/system-variables.md +++ b/system-variables.md @@ -290,12 +290,12 @@ Constraint checking is always performed in place for pessimistic transactions (d - Scope: SESSION | GLOBAL - Default value: 1 - This variable is used to control whether to enable the Clustered Index feature. - - This feature is only applicable to newly created tables and will not affect old tables that have been created. + - This feature is only applicable to newly created tables and has no effect on old tables that have been created. - This feature is only applicable to tables of single column non-integer primary key and multi-column primary key. It does not affect tables without primary keys and tables with single column integer primary keys. - You can execute `select tidb_pk_type from information_schema.tables where table_name ='{table_name}'` to check whether a table uses the Clustered Index feature. -- After you enable the feature, rows are stored directly on the primary key instead of the rows_ID allocated within the system, and use the extra created primary key index to point to row_id. +- After you enable this feature, rows are stored directly on the primary key instead of the rows_id allocated within the system, and use the extra created primary key index to point to row_id. - The impact of this variable on performance is mainly reflected in the following aspects: + The impact of this feature on performance is mainly reflected in the following aspects: - When inserting this variable, each row reduces the write of one index key. - When using the primary key as the equivalent condition query, you can save one read request. - When using a single-column primary key as a range condition query, you can save multiple read requests. From d05c183ca5edaa0045ea2fb9831aeab32a100ce7 Mon Sep 17 00:00:00 2001 From: JoyinQ <56883733+Joyinqin@users.noreply.github.com> Date: Tue, 15 Sep 2020 17:37:36 +0800 Subject: [PATCH 3/7] Apply suggestions from code review Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com> --- system-variables.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/system-variables.md b/system-variables.md index 5617cdb0d12d2..7144cc323e2ac 100644 --- a/system-variables.md +++ b/system-variables.md @@ -289,17 +289,17 @@ Constraint checking is always performed in place for pessimistic transactions (d - Scope: SESSION | GLOBAL - Default value: 1 -- This variable is used to control whether to enable the Clustered Index feature. - - This feature is only applicable to newly created tables and has no effect on old tables that have been created. - - This feature is only applicable to tables of single column non-integer primary key and multi-column primary key. It does not affect tables without primary keys and tables with single column integer primary keys. - - You can execute `select tidb_pk_type from information_schema.tables where table_name ='{table_name}'` to check whether a table uses the Clustered Index feature. -- After you enable this feature, rows are stored directly on the primary key instead of the rows_id allocated within the system, and use the extra created primary key index to point to row_id. - - The impact of this feature on performance is mainly reflected in the following aspects: - - When inserting this variable, each row reduces the write of one index key. - - When using the primary key as the equivalent condition query, you can save one read request. - - When using a single-column primary key as a range condition query, you can save multiple read requests. - - When using the prefix of a multi-column primary key as an equivalent or range condition query, you can save multiple read requests. +- This variable is used to control whether to enable the clustered index feature. + - This feature is only applicable to newly created tables and does not affect the existing old tables. + - This feature is only applicable to tables whose primary key is the single-column non-integer type or the multi-column type. It does not affect tables without a primary key and tables with the primary key of the single-column non-integer type. + - You can execute `select tidb_pk_type from information_schema.tables where table_name ='{table_name}'` to check whether the clustered index feature has been enabled on a table. +- After you enable this feature, rows are stored directly on the primary key instead of on the internally allocated `rows_id` and using the extra primary key index created to point to `row_id`. + + This feature impacts performance in the following aspects: + - For each `INSERT` operation, there is one less index key written into each row. + - When you make a query using the primary key as the equivalent condition, one read request can be saved. + - When you make a query using the primary key as the range condition, multiple read requests can be saved. + - When you make a query using the prefix of the multi-column primary key as the equivalent condition or range condition, multiple read requests can be saved. ### tidb_enable_chunk_rpc New in v4.0 From 06d0ef6384fe878d6ab39aa0014d7ed0e379e59b Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 16 Sep 2020 13:22:39 +0800 Subject: [PATCH 4/7] comment out version mark --- system-variables.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-variables.md b/system-variables.md index 7144cc323e2ac..a8829c24b0d05 100644 --- a/system-variables.md +++ b/system-variables.md @@ -285,15 +285,15 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: 0 - This variable is used to control whether to enable the cascades planner, which is currently considered experimental. -### `tidb_enable_clustered_index` New in 5.0 +### tidb_enable_clustered_index - Scope: SESSION | GLOBAL - Default value: 1 - This variable is used to control whether to enable the clustered index feature. - This feature is only applicable to newly created tables and does not affect the existing old tables. - - This feature is only applicable to tables whose primary key is the single-column non-integer type or the multi-column type. It does not affect tables without a primary key and tables with the primary key of the single-column non-integer type. + - This feature is only applicable to tables whose primary key is the single-column non-integer type or the multi-column type. It does not affect the tables without a primary key and tables with the primary key of the single-column non-integer type. - You can execute `select tidb_pk_type from information_schema.tables where table_name ='{table_name}'` to check whether the clustered index feature has been enabled on a table. -- After you enable this feature, rows are stored directly on the primary key instead of on the internally allocated `rows_id` and using the extra primary key index created to point to `row_id`. +- After you enable this feature, rows are stored directly on the primary key instead of on the internally allocated `rows_id` to which the extra primary key index is created to point. This feature impacts performance in the following aspects: - For each `INSERT` operation, there is one less index key written into each row. From 5cdcb9006bcd78caf37f6a1e082f6dab1d755c5f Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 16 Sep 2020 13:33:02 +0800 Subject: [PATCH 5/7] 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 a8829c24b0d05..5cbc874ddf328 100644 --- a/system-variables.md +++ b/system-variables.md @@ -291,7 +291,7 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: 1 - This variable is used to control whether to enable the clustered index feature. - This feature is only applicable to newly created tables and does not affect the existing old tables. - - This feature is only applicable to tables whose primary key is the single-column non-integer type or the multi-column type. It does not affect the tables without a primary key and tables with the primary key of the single-column non-integer type. + - This feature is only applicable to tables whose primary key is the single-column non-integer type or the multi-column type. It does not affect the tables without a primary key or tables with the primary key of the single-column non-integer type. - You can execute `select tidb_pk_type from information_schema.tables where table_name ='{table_name}'` to check whether the clustered index feature has been enabled on a table. - After you enable this feature, rows are stored directly on the primary key instead of on the internally allocated `rows_id` to which the extra primary key index is created to point. From a78beea64c1b3fc6c4c89ecd208995900bdf38db Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 16 Sep 2020 13:57:21 +0800 Subject: [PATCH 6/7] 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 5cbc874ddf328..d43d5904adac4 100644 --- a/system-variables.md +++ b/system-variables.md @@ -285,7 +285,7 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: 0 - This variable is used to control whether to enable the cascades planner, which is currently considered experimental. -### tidb_enable_clustered_index +### tidb_enable_clustered_index Upcoming in v5.0 - Scope: SESSION | GLOBAL - Default value: 1 From 41c20f3c623d131e9ed0effaad065ccd66b9b1bf Mon Sep 17 00:00:00 2001 From: TomShawn <41534398+TomShawn@users.noreply.github.com> Date: Wed, 16 Sep 2020 14:28:00 +0800 Subject: [PATCH 7/7] 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 d43d5904adac4..0fa6217a2436d 100644 --- a/system-variables.md +++ b/system-variables.md @@ -285,7 +285,7 @@ Constraint checking is always performed in place for pessimistic transactions (d - Default value: 0 - This variable is used to control whether to enable the cascades planner, which is currently considered experimental. -### tidb_enable_clustered_index Upcoming in v5.0 +### tidb_enable_clustered_index - Scope: SESSION | GLOBAL - Default value: 1