From d9673c249ba25e09034dee09dc8ec28ea164da4c Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 10:59:15 +0800 Subject: [PATCH 01/11] 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 3906042653cf55b293cb1c8538c243c72f5ae007 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 10:59:21 +0800 Subject: [PATCH 02/11] 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 0e2681ed31ff6079b5e58426d92014b7adb30261 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 6 Jan 2026 03:00:44 +0000 Subject: [PATCH 03/11] 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 3f0d87dec5b5a..279dcf4872432 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -6,14 +6,32 @@ aliases: ['/docs/dev/sql-statements/sql-statement-modify-column/','/docs/dev/ref # 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 @@ -168,7 +186,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 3a02f974db88bdbd1efd997e6a66a01ad842315d Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 11:01:50 +0800 Subject: [PATCH 04/11] 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 279dcf4872432..6995623ba9a60 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -30,8 +30,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 fa8d3516b400d9dd8f07eccd82ccbef4732aad4f Mon Sep 17 00:00:00 2001 From: qiancai Date: Tue, 6 Jan 2026 15:49:17 +0800 Subject: [PATCH 05/11] 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 6995623ba9a60..8a32cb10d1071 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -6,29 +6,29 @@ aliases: ['/docs/dev/sql-statements/sql-statement-modify-column/','/docs/dev/ref # 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 @@ -75,7 +75,7 @@ DefaultValueExpr ::= ## Examples -### Meta-Only Change +### Meta-only change {{< copyable "sql" >}} @@ -125,7 +125,7 @@ Create Table: CREATE TABLE `t1` ( 1 row in set (0.00 sec) ``` -### Reorg-Data Change +### Reorg-Data change {{< copyable "sql" >}} From 63d1e040f7ddbd9260265637f815160239bafddc Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 6 Jan 2026 15:57:48 +0800 Subject: [PATCH 06/11] 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 8a32cb10d1071..43b7a18afc849 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -184,7 +184,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 cd7ce201db45772277b3df100b1af60e28e34803 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:32:11 +0800 Subject: [PATCH 07/11] 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 43b7a18afc849..cff867aeaf1c8 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -16,7 +16,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. @@ -28,7 +28,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 92fbcc6d64c4bfd8c40dc42718cb1e48a3311d4e Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:34:28 +0800 Subject: [PATCH 08/11] 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 cff867aeaf1c8..8899fdaecdaf4 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -19,12 +19,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 0c8619500ee42e2cbf69500941e12a8d175fa4e5 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:35:01 +0800 Subject: [PATCH 09/11] 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 8899fdaecdaf4..2458d7dc43a93 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -22,7 +22,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 11e9d90cbe4ff6b768ee42658ce8f244b0258f13 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:36:33 +0800 Subject: [PATCH 10/11] 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 2458d7dc43a93..5f64c33921d77 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -11,7 +11,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 4fa97a230d78ac49b1d3d763bb76df994fc0d730 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Tue, 13 Jan 2026 17:50:51 +0800 Subject: [PATCH 11/11] 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 5f64c33921d77..2458d7dc43a93 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -11,6 +11,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)`