From adbd22ac73a6cd2873278fe6d159ba1244db8ca6 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 10:59:15 +0800 Subject: [PATCH 01/12] 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 084769705742e13780a8a04146a6d8f9912c65b5 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 10:59:21 +0800 Subject: [PATCH 02/12] 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 37158b3bd69a87a47adf9116d3dd95692c9c1a09 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 6 Jan 2026 03:00:44 +0000 Subject: [PATCH 03/12] Auto-sync: Update English docs from Chinese PR Synced from: https://github.com/pingcap/docs-cn/pull/21110 Target PR: https://github.com/pingcap/docs/pull/22268 AI Provider: gemini Co-authored-by: github-actions[bot] --- sql-statements/sql-statement-modify-column.md | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 78cba0a5040d8..6d11247cfa554 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -5,14 +5,32 @@ summary: An overview of the usage of MODIFY COLUMN for the TiDB database. # MODIFY COLUMN -The `ALTER TABLE.. MODIFY COLUMN` statement modifies a column on an existing table. The modification can include changing the data type and attributes. To rename at the same time, use the [`CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement instead. +The `ALTER TABLE ... MODIFY COLUMN` statement modifies a column on an existing table. The modification can include changing the data type and attributes. To rename at the same time, use the [`CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement instead. -Since v5.1.0, TiDB has supported changes of data types for Reorg data, including but not limited to: +Since v5.1.0, TiDB supports column type changes that require Reorg-Data. When performing such changes, TiDB rebuilds all existing data in the table. The specific process includes reading original table data, converting the data according to the new column type, and then rewriting the converted data into the table. Since it needs to process all table data, Reorg-Data operations usually take a long time, and their execution time is directly proportional to the amount of data in the table. + +The following are some common examples of column type changes that require Reorg-Data: - Changing `VARCHAR` to `BIGINT` - Modifying the `DECIMAL` precision - Compressing the length of `VARCHAR(10)` to `VARCHAR(5)` +Starting from v8.5.5 and v9.0.0, TiDB has optimized some column type changes that originally required Reorg-Data. When the following conditions are met, TiDB will no longer rebuild table data but only rebuild affected indexes, thereby improving execution efficiency: + +- The current session's [SQL mode](/sql-mode.md) is strict mode (`sql_mode` includes `STRICT_TRANS_TABLES` or `STRICT_ALL_TABLES`). +- There is no risk of data truncation during type conversion. + +This optimization applies to the following type change scenarios: + +- Changes between integer types (for example, from `BIGINT` to `INT`). +- Changes between string types (for example, from `VARCHAR(200)` to `VARCHAR(100)`). + +> **Note:** +> +> When converting from `VARCHAR` to `CHAR`, all original data must not contain trailing spaces. If data that does not meet this condition exists, TiDB will still perform Reorg-Data to ensure that the converted data complies with the `CHAR` type's padding rules. + +## 语法图 +``` ## Synopsis ```ebnf+diagram @@ -160,7 +178,7 @@ CREATE TABLE `t1` ( > ERROR 1406 (22001): Data Too Long, field len 4, data len 5 > ``` > -> - Due to the compatibility with the Async Commit feature, the DDL statement waits for a period of time (about 2.5s) before starting to process into Reorg Data. +> - Due to the compatibility with the Async Commit feature, when [metadata lock](/metadata-lock.md) is disabled, the DDL statement waits for a period of time (about 2.5s) before starting to process into Reorg-Data. > > ``` > Query OK, 0 rows affected (2.52 sec) From 8c90a58201cd9b058e59a5083b01f36eeacccb27 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 11:01:50 +0800 Subject: [PATCH 04/12] Update sql-statements/sql-statement-modify-column.md --- sql-statements/sql-statement-modify-column.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 6d11247cfa554..de50318b20550 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -29,8 +29,6 @@ This optimization applies to the following type change scenarios: > > When converting from `VARCHAR` to `CHAR`, all original data must not contain trailing spaces. If data that does not meet this condition exists, TiDB will still perform Reorg-Data to ensure that the converted data complies with the `CHAR` type's padding rules. -## 语法图 -``` ## Synopsis ```ebnf+diagram From d77dcba2bea249b5e1b84f77cc01250cbea7a9b5 Mon Sep 17 00:00:00 2001 From: qiancai Date: Tue, 6 Jan 2026 15:49:17 +0800 Subject: [PATCH 05/12] Update sql-statement-modify-column.md --- sql-statements/sql-statement-modify-column.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index de50318b20550..4f98cabed4ad3 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -5,29 +5,29 @@ summary: An overview of the usage of MODIFY COLUMN for the TiDB database. # MODIFY COLUMN -The `ALTER TABLE ... MODIFY COLUMN` statement modifies a column on an existing table. The modification can include changing the data type and attributes. To rename at the same time, use the [`CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement instead. +The `ALTER TABLE ... MODIFY COLUMN` statement modifies a column on an existing table. The modification can include changing the data type and attributes. To rename the column at the same time, use the [`CHANGE COLUMN`](/sql-statements/sql-statement-change-column.md) statement instead. -Since v5.1.0, TiDB supports column type changes that require Reorg-Data. When performing such changes, TiDB rebuilds all existing data in the table. The specific process includes reading original table data, converting the data according to the new column type, and then rewriting the converted data into the table. Since it needs to process all table data, Reorg-Data operations usually take a long time, and their execution time is directly proportional to the amount of data in the table. +Starting from v5.1.0, TiDB supports column type changes that require Reorg-Data. When performing such changes, TiDB rebuilds all existing data in the table by reading the original data, converting it to the new column type, and then writing the converted data back to the table. Because all table data must be processed, Reorg-Data operations typically take a long time, and the execution time is proportional to the amount of data in the table. The following are some common examples of column type changes that require Reorg-Data: - Changing `VARCHAR` to `BIGINT` - Modifying the `DECIMAL` precision -- Compressing the length of `VARCHAR(10)` to `VARCHAR(5)` +- Reducing the length of `VARCHAR(10)` to `VARCHAR(5)` -Starting from v8.5.5 and v9.0.0, TiDB has optimized some column type changes that originally required Reorg-Data. When the following conditions are met, TiDB will no longer rebuild table data but only rebuild affected indexes, thereby improving execution efficiency: +Starting from v8.5.5 and v9.0.0, TiDB optimizes some column type changes that previously required Reorg-Data. When the following conditions are met, TiDB no longer rebuilds the table data; instead, it rebuilds only the affected indexes, thereby improving execution efficiency: -- The current session's [SQL mode](/sql-mode.md) is strict mode (`sql_mode` includes `STRICT_TRANS_TABLES` or `STRICT_ALL_TABLES`). +- The current session uses a strict [SQL mode](/sql-mode.md) (`sql_mode` includes `STRICT_TRANS_TABLES` or `STRICT_ALL_TABLES`). - There is no risk of data truncation during type conversion. This optimization applies to the following type change scenarios: -- Changes between integer types (for example, from `BIGINT` to `INT`). -- Changes between string types (for example, from `VARCHAR(200)` to `VARCHAR(100)`). +- Conversions between integer types, such as from `BIGINT` to `INT` +- Conversions between string types, such as from `VARCHAR(200)` to `VARCHAR(100)` > **Note:** > -> When converting from `VARCHAR` to `CHAR`, all original data must not contain trailing spaces. If data that does not meet this condition exists, TiDB will still perform Reorg-Data to ensure that the converted data complies with the `CHAR` type's padding rules. +> When converting from `VARCHAR` to `CHAR`, the original data must not contain trailing spaces. If the original data contains trailing spaces, TiDB still performs Reorg-Data to ensure that the converted data complies with the padding rules of the `CHAR` type. ## Synopsis @@ -67,7 +67,7 @@ ColumnName ::= ## Examples -### Meta-Only Change +### Meta-only change {{< copyable "sql" >}} @@ -117,7 +117,7 @@ Create Table: CREATE TABLE `t1` ( 1 row in set (0.00 sec) ``` -### Reorg-Data Change +### Reorg-Data change {{< copyable "sql" >}} From 3838f3fa7ffce804abdab182baa216cac64ba5fc Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 15:57:48 +0800 Subject: [PATCH 06/12] Update sql-statements/sql-statement-modify-column.md --- sql-statements/sql-statement-modify-column.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 4f98cabed4ad3..60f1cd78b4cfd 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -176,7 +176,7 @@ CREATE TABLE `t1` ( > ERROR 1406 (22001): Data Too Long, field len 4, data len 5 > ``` > -> - Due to the compatibility with the Async Commit feature, when [metadata lock](/metadata-lock.md) is disabled, the DDL statement waits for a period of time (about 2.5s) before starting to process into Reorg-Data. +> - Due to the compatibility with the Async Commit feature, when [Metadata lock](/metadata-lock.md) is disabled, the DDL statement waits for a period of time (about 2.5s) before starting to process into Reorg-Data. > > ``` > Query OK, 0 rows affected (2.52 sec) From 224bafd17c1a484dff9332629fe74f4b1fd43a4f Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:32:11 +0800 Subject: [PATCH 07/12] Apply suggestions from code review Co-authored-by: Aolin --- sql-statements/sql-statement-modify-column.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 60f1cd78b4cfd..f05aeaaf790f9 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -15,7 +15,7 @@ The following are some common examples of column type changes that require Reorg - Modifying the `DECIMAL` precision - Reducing the length of `VARCHAR(10)` to `VARCHAR(5)` -Starting from v8.5.5 and v9.0.0, TiDB optimizes some column type changes that previously required Reorg-Data. When the following conditions are met, TiDB no longer rebuilds the table data; instead, it rebuilds only the affected indexes, thereby improving execution efficiency: +Starting from v8.5.5 and v9.0.0, TiDB optimizes some column type changes that previously required Reorg-Data. When the following conditions are met, TiDB rebuilds only the affected indexes instead of the entire table, thereby improving execution efficiency: - The current session uses a strict [SQL mode](/sql-mode.md) (`sql_mode` includes `STRICT_TRANS_TABLES` or `STRICT_ALL_TABLES`). - There is no risk of data truncation during type conversion. @@ -27,7 +27,7 @@ This optimization applies to the following type change scenarios: > **Note:** > -> When converting from `VARCHAR` to `CHAR`, the original data must not contain trailing spaces. If the original data contains trailing spaces, TiDB still performs Reorg-Data to ensure that the converted data complies with the padding rules of the `CHAR` type. +> When converting from `VARCHAR` to `CHAR`, the original data must not contain trailing spaces. If the original data contains trailing spaces, TiDB still performs Reorg-Data to ensure that the converted values comply with the padding rules of the `CHAR` type. ## Synopsis From d2d6c4f6cb0e295c272875366b7095a545d2ba0b Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:34:28 +0800 Subject: [PATCH 08/12] sync from zh --- sql-statements/sql-statement-modify-column.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index f05aeaaf790f9..e2804886d321c 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -18,12 +18,13 @@ The following are some common examples of column type changes that require Reorg Starting from v8.5.5 and v9.0.0, TiDB optimizes some column type changes that previously required Reorg-Data. When the following conditions are met, TiDB rebuilds only the affected indexes instead of the entire table, thereby improving execution efficiency: - The current session uses a strict [SQL mode](/sql-mode.md) (`sql_mode` includes `STRICT_TRANS_TABLES` or `STRICT_ALL_TABLES`). +- The table has no TiFlash replicas. - There is no risk of data truncation during type conversion. This optimization applies to the following type change scenarios: - Conversions between integer types, such as from `BIGINT` to `INT` -- Conversions between string types, such as from `VARCHAR(200)` to `VARCHAR(100)` +- Conversions between string types where the character set remains unchanged, such as from `VARCHAR(200)` to `VARCHAR(100)` > **Note:** > From 920a27d615d3aa94f6783e0aa5b15e070988c2a9 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:35:01 +0800 Subject: [PATCH 09/12] Update sql-statements/sql-statement-modify-column.md --- sql-statements/sql-statement-modify-column.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index e2804886d321c..7f26d4e84ac91 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -21,7 +21,7 @@ Starting from v8.5.5 and v9.0.0, TiDB optimizes some column type changes that pr - The table has no TiFlash replicas. - There is no risk of data truncation during type conversion. -This optimization applies to the following type change scenarios: +This optimization only applies to the following type change scenarios: - Conversions between integer types, such as from `BIGINT` to `INT` - Conversions between string types where the character set remains unchanged, such as from `VARCHAR(200)` to `VARCHAR(100)` From 44827c8562e6691046ca155c9905499d7c78015d Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:36:33 +0800 Subject: [PATCH 10/12] remove an empty line --- sql-statements/sql-statement-modify-column.md | 1 - 1 file changed, 1 deletion(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 7f26d4e84ac91..13bdc9fbc82aa 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -10,7 +10,6 @@ The `ALTER TABLE ... MODIFY COLUMN` statement modifies a column on an existing t Starting from v5.1.0, TiDB supports column type changes that require Reorg-Data. When performing such changes, TiDB rebuilds all existing data in the table by reading the original data, converting it to the new column type, and then writing the converted data back to the table. Because all table data must be processed, Reorg-Data operations typically take a long time, and the execution time is proportional to the amount of data in the table. The following are some common examples of column type changes that require Reorg-Data: - - Changing `VARCHAR` to `BIGINT` - Modifying the `DECIMAL` precision - Reducing the length of `VARCHAR(10)` to `VARCHAR(5)` From 2de6fe0da6d2333ce7d00306336837a0af6d6bb8 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:50:51 +0800 Subject: [PATCH 11/12] Update sql-statements/sql-statement-modify-column.md --- sql-statements/sql-statement-modify-column.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 13bdc9fbc82aa..7f26d4e84ac91 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -10,6 +10,7 @@ The `ALTER TABLE ... MODIFY COLUMN` statement modifies a column on an existing t Starting from v5.1.0, TiDB supports column type changes that require Reorg-Data. When performing such changes, TiDB rebuilds all existing data in the table by reading the original data, converting it to the new column type, and then writing the converted data back to the table. Because all table data must be processed, Reorg-Data operations typically take a long time, and the execution time is proportional to the amount of data in the table. The following are some common examples of column type changes that require Reorg-Data: + - Changing `VARCHAR` to `BIGINT` - Modifying the `DECIMAL` precision - Reducing the length of `VARCHAR(10)` to `VARCHAR(5)` From fbe9b556d81b55d1b70e0f27cdfb56a88bf86a84 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 18:09:03 +0800 Subject: [PATCH 12/12] Update sql-statements/sql-statement-modify-column.md --- sql-statements/sql-statement-modify-column.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 7f26d4e84ac91..fd387ab59820b 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -15,7 +15,7 @@ The following are some common examples of column type changes that require Reorg - Modifying the `DECIMAL` precision - Reducing the length of `VARCHAR(10)` to `VARCHAR(5)` -Starting from v8.5.5 and v9.0.0, TiDB optimizes some column type changes that previously required Reorg-Data. When the following conditions are met, TiDB rebuilds only the affected indexes instead of the entire table, thereby improving execution efficiency: +Starting from v8.5.5, TiDB optimizes some column type changes that previously required Reorg-Data. When the following conditions are met, TiDB rebuilds only the affected indexes instead of the entire table, thereby improving execution efficiency: - The current session uses a strict [SQL mode](/sql-mode.md) (`sql_mode` includes `STRICT_TRANS_TABLES` or `STRICT_ALL_TABLES`). - The table has no TiFlash replicas.