From 5b12664f4c071d76ab6fbfe668739b53af2713d7 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 17:39:09 +0800 Subject: [PATCH 01/12] change --- sql-statements/sql-statement-import-into.md | 64 ++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 80c76a6efa20e..c714a9b332f7b 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -30,7 +30,7 @@ The `IMPORT INTO` statement lets you import data to TiDB via the [Physical Impor - For TiDB Self-Managed, the TiDB [temporary directory](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#temp-dir-new-in-v630) is expected to have at least 90 GiB of available space. It is recommended to allocate storage space that is equal to or greater than the volume of data to be imported. - One import job supports importing data into one target table only. - `IMPORT INTO` is not supported during TiDB cluster upgrades. -- Ensure that the data to be imported does not contain any records with primary key or non-null unique index conflicts. Otherwise, the conflicts can result in import task failures. +- When not using [Global Sort](/tidb-global-sort.md) or using version <= v8.5.4, ensure that the data to be imported does not contain any records with primary key or non-null unique index conflicts. Otherwise, the conflicts can result in import task failures. Since version v8.5.5, when using [Global Sort](/tidb-global-sort.md), `IMPORT INTO` can automatically handle primary key or unique index conflicts by removing all conflicting rows. - Known issue: the `IMPORT INTO` task might fail if the PD address in the TiDB node configuration file is inconsistent with the current PD topology of the cluster. This inconsistency can arise in situations such as that PD was scaled in previously, but the TiDB configuration file was not updated accordingly or the TiDB node was not restarted after the configuration file update. ### `IMPORT INTO ... FROM FILE` restrictions @@ -227,6 +227,42 @@ SET GLOBAL tidb_server_memory_limit='75%'; > - If the KV range overlap in a source data file is low, enabling Global Sort might decrease import performance. This is because when Global Sort is enabled, TiDB needs to wait for the completion of local sorting in all sub-jobs before proceeding with the Global Sort operations and subsequent import. > - After an import job using Global Sort completes, the files stored in the cloud storage for Global Sort are cleaned up asynchronously in a background thread. +#### Conflict resolution + +Since version v8.5.5, when using [Global Sort](/tidb-global-sort.md), `IMPORT INTO` can automatically handle primary key or unique index conflicts by removing all conflicting rows. + +Such as when importing into a table `create table t(id int primary key, v int);`, with below data file `conflicts.csv`: +```csv +id,v +1,2 +1,3 +2,2 +3,3 +3,3 +4,4 +``` + +After import, the table `t` only contains the non-conflicting rows: +```sql +mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8, skip_rows=1; ++--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ +| Job_ID | Data_Source | Target_Table | Table_ID | Phase | Status | Source_File_Size | Imported_Rows | Result_Message | Create_Time | Start_Time | End_Time | Created_By | ++--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ +| 30001 | s3://mybucket/conflicts.csv | `test`.`t` | 114 | | finished | 24B | 2 | 4 conflicted rows. | 2025-11-28 17:21:40.591023 | 2025-11-28 17:21:41.109977 | 2025-11-28 17:21:44.112506 | root@% | ++--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ + +mysql> select * from t; ++----+------+ +| id | v | ++----+------+ +| 2 | 2 | +| 4 | 4 | ++----+------+ +2 rows in set (0.01 sec) +``` + +The conflicted rows details will be stored in the cloud storage URI, see more info in `Conflicted rows info when using Global Sort` section. + ### Output When `IMPORT INTO ... FROM FILE` completes the import or when the `DETACHED` mode is enabled, TiDB returns the current job information in the output, as shown in the following examples. For the description of each field, see [`SHOW IMPORT JOB(s)`](/sql-statements/sql-statement-show-import-job.md). @@ -253,6 +289,32 @@ IMPORT INTO t FROM '/path/to/small.csv' WITH DETACHED; +--------+--------------------+--------------+----------+-------+---------+------------------+---------------+----------------+----------------------------+------------+----------+------------+ ``` +#### Conflicted rows info when using Global Sort + +When using [Global Sort](/tidb-global-sort.md) and there are conflicted rows for the import job, the number of conflicted rows will be displayed in the `Result_Message` column of [`SHOW IMPORT`](/sql-statements/sql-statement-show-import-job.md), like this: + +```sql +mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8; ++--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ +| Job_ID | Data_Source | Target_Table | Table_ID | Phase | Status | Source_File_Size | Imported_Rows | Result_Message | Create_Time | Start_Time | End_Time | Created_By | ++--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ +| 30001 | s3://mybucket/conflicts.csv | `test`.`t` | 114 | | finished | 24B | 2 | 4 conflicted rows. | 2025-11-28 17:21:40.591023 | 2025-11-28 17:21:41.109977 | 2025-11-28 17:21:44.112506 | root@% | ++--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ +``` + +And the conflicted rows details can be viewed under the `conflicted-rows/` folder of the cloud storage URI, such as: + +``` +s3://mybucket/sorted-dir/conflicted-rows/1/1-28f0e03a-27c3-4283-a523-418859bb7a2c/data-1.txt +s3://mybucket/sorted-dir/conflicted-rows/1/1-298a387a-065c-4ea9-bc31-949e89ca186f/data-1.txt +s3://mybucket/sorted-dir/conflicted-rows/1/1-2e306ff5-40eb-4045-9992-2ccc04ab7bef/data-1.txt +s3://mybucket/sorted-dir/conflicted-rows/1/1-382d8886-f6e9-4c5e-891c-69d54694a175/data-1.txt +s3://mybucket/sorted-dir/conflicted-rows/1/1-3fd1b7e7-70d4-4734-a12f-ec4f70c3a9af/data-1.txt +s3://mybucket/sorted-dir/conflicted-rows/1/1-46320371-436f-46fa-a8ab-b0f2e2eecf75/data-1.txt +s3://mybucket/sorted-dir/conflicted-rows/1/1-631f1c02-4a25-4c8f-9e8d-6ae61a801f5c/data-1.txt +s3://mybucket/sorted-dir/conflicted-rows/1/1-68f84255-4965-4d9e-9add-934ba07b5ef1/data-1.txt +``` + ### View and manage import jobs For an import job with the `DETACHED` mode enabled, you can use [`SHOW IMPORT`](/sql-statements/sql-statement-show-import-job.md) to view its current job progress. From 44dd463b35b45651603a73eba064c5edf791944f Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 18:03:11 +0800 Subject: [PATCH 02/12] Update sql-statements/sql-statement-import-into.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index c714a9b332f7b..550311882c64e 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -294,7 +294,7 @@ IMPORT INTO t FROM '/path/to/small.csv' WITH DETACHED; When using [Global Sort](/tidb-global-sort.md) and there are conflicted rows for the import job, the number of conflicted rows will be displayed in the `Result_Message` column of [`SHOW IMPORT`](/sql-statements/sql-statement-show-import-job.md), like this: ```sql -mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8; +mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8, skip_rows=1; +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ | Job_ID | Data_Source | Target_Table | Table_ID | Phase | Status | Source_File_Size | Imported_Rows | Result_Message | Create_Time | Start_Time | End_Time | Created_By | +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ From d722e1daf1b7435e96f5f1f1f44db9f702ae8e44 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 18:03:27 +0800 Subject: [PATCH 03/12] Update sql-statements/sql-statement-import-into.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 550311882c64e..e29cf9b881f93 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -229,7 +229,7 @@ SET GLOBAL tidb_server_memory_limit='75%'; #### Conflict resolution -Since version v8.5.5, when using [Global Sort](/tidb-global-sort.md), `IMPORT INTO` can automatically handle primary key or unique index conflicts by removing all conflicting rows. +Starting from v8.5.5, when you use [Global Sort](/tidb-global-sort.md), `IMPORT INTO` automatically resolves primary key or unique index conflicts by removing all conflicting rows. Such as when importing into a table `create table t(id int primary key, v int);`, with below data file `conflicts.csv`: ```csv From e66da8ea85e256b436551a3725c86f449a663905 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 18:03:38 +0800 Subject: [PATCH 04/12] Update sql-statements/sql-statement-import-into.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index e29cf9b881f93..81dd57bd24064 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -231,7 +231,7 @@ SET GLOBAL tidb_server_memory_limit='75%'; Starting from v8.5.5, when you use [Global Sort](/tidb-global-sort.md), `IMPORT INTO` automatically resolves primary key or unique index conflicts by removing all conflicting rows. -Such as when importing into a table `create table t(id int primary key, v int);`, with below data file `conflicts.csv`: +For example, when you import data into a table `create table t(id int primary key, v int);` from the following data file `conflicts.csv`: ```csv id,v 1,2 From 8df8a7e89ed303c5127ef21e064364b00bb6e5e7 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 18:03:52 +0800 Subject: [PATCH 05/12] Update sql-statements/sql-statement-import-into.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 81dd57bd24064..c9d26fd86791a 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -261,7 +261,7 @@ mysql> select * from t; 2 rows in set (0.01 sec) ``` -The conflicted rows details will be stored in the cloud storage URI, see more info in `Conflicted rows info when using Global Sort` section. +Details of the conflicted rows are stored in the cloud storage URI. For more information, see the `Conflicted rows info when using Global Sort` section. ### Output From 0e680513e5034dfcb673849f23328d4ab8739578 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 18:04:07 +0800 Subject: [PATCH 06/12] Update sql-statements/sql-statement-import-into.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index c9d26fd86791a..1f6197daf2ca6 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -291,7 +291,7 @@ IMPORT INTO t FROM '/path/to/small.csv' WITH DETACHED; #### Conflicted rows info when using Global Sort -When using [Global Sort](/tidb-global-sort.md) and there are conflicted rows for the import job, the number of conflicted rows will be displayed in the `Result_Message` column of [`SHOW IMPORT`](/sql-statements/sql-statement-show-import-job.md), like this: +When you use [Global Sort](/tidb-global-sort.md) and an import job has conflicted rows, the number of conflicted rows is displayed in the `Result_Message` column of [`SHOW IMPORT`](/sql-statements/sql-statement-show-import-job.md), as shown in the following example: ```sql mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8, skip_rows=1; From 167d850f0a3ac36f42342c3b7fb1025cdf97be38 Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 18:04:24 +0800 Subject: [PATCH 07/12] Update sql-statements/sql-statement-import-into.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 1f6197daf2ca6..9ee1d887cc95b 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -302,7 +302,7 @@ mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8, skip_rows +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ ``` -And the conflicted rows details can be viewed under the `conflicted-rows/` folder of the cloud storage URI, such as: +You can view the details of the conflicted rows in the `conflicted-rows/` folder of the cloud storage URI. For example: ``` s3://mybucket/sorted-dir/conflicted-rows/1/1-28f0e03a-27c3-4283-a523-418859bb7a2c/data-1.txt From d133d63b33660c03f56a15025fd339b58979adbf Mon Sep 17 00:00:00 2001 From: D3Hunter Date: Fri, 28 Nov 2025 18:04:50 +0800 Subject: [PATCH 08/12] Update sql-statements/sql-statement-import-into.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 9ee1d887cc95b..39b519fdcb0ce 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -30,7 +30,7 @@ The `IMPORT INTO` statement lets you import data to TiDB via the [Physical Impor - For TiDB Self-Managed, the TiDB [temporary directory](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#temp-dir-new-in-v630) is expected to have at least 90 GiB of available space. It is recommended to allocate storage space that is equal to or greater than the volume of data to be imported. - One import job supports importing data into one target table only. - `IMPORT INTO` is not supported during TiDB cluster upgrades. -- When not using [Global Sort](/tidb-global-sort.md) or using version <= v8.5.4, ensure that the data to be imported does not contain any records with primary key or non-null unique index conflicts. Otherwise, the conflicts can result in import task failures. Since version v8.5.5, when using [Global Sort](/tidb-global-sort.md), `IMPORT INTO` can automatically handle primary key or unique index conflicts by removing all conflicting rows. +- When not using [Global Sort](/tidb-global-sort.md) or using a version earlier than v8.5.5, you must ensure that the data to be imported does not contain any records with primary key or non-null unique index conflicts, as this will cause the import task to fail. Starting from v8.5.5, when you use [Global Sort](/tidb-global-sort.md), `IMPORT INTO` automatically resolves these conflicts by removing all conflicting rows. - Known issue: the `IMPORT INTO` task might fail if the PD address in the TiDB node configuration file is inconsistent with the current PD topology of the cluster. This inconsistency can arise in situations such as that PD was scaled in previously, but the TiDB configuration file was not updated accordingly or the TiDB node was not restarted after the configuration file update. ### `IMPORT INTO ... FROM FILE` restrictions From 18a0f2025b6ac275d6e841922cd691d06d482d65 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Wed, 3 Dec 2025 16:01:05 +0800 Subject: [PATCH 09/12] revise descriptions --- sql-statements/sql-statement-import-into.md | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 39b519fdcb0ce..0e78865de3d37 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -30,7 +30,7 @@ The `IMPORT INTO` statement lets you import data to TiDB via the [Physical Impor - For TiDB Self-Managed, the TiDB [temporary directory](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#temp-dir-new-in-v630) is expected to have at least 90 GiB of available space. It is recommended to allocate storage space that is equal to or greater than the volume of data to be imported. - One import job supports importing data into one target table only. - `IMPORT INTO` is not supported during TiDB cluster upgrades. -- When not using [Global Sort](/tidb-global-sort.md) or using a version earlier than v8.5.5, you must ensure that the data to be imported does not contain any records with primary key or non-null unique index conflicts, as this will cause the import task to fail. Starting from v8.5.5, when you use [Global Sort](/tidb-global-sort.md), `IMPORT INTO` automatically resolves these conflicts by removing all conflicting rows. +- When not using [Global Sort](/tidb-global-sort.md) or when using a version earlier than v8.5.5, you must ensure that the data to be imported does not contain any records with primary key or non-null unique index conflicts, because such conflicts will cause the import task to fail. Starting from v8.5.5, when you use [Global Sort](/tidb-global-sort.md), `IMPORT INTO` automatically resolves these conflicts by removing all conflicting rows. - Known issue: the `IMPORT INTO` task might fail if the PD address in the TiDB node configuration file is inconsistent with the current PD topology of the cluster. This inconsistency can arise in situations such as that PD was scaled in previously, but the TiDB configuration file was not updated accordingly or the TiDB node was not restarted after the configuration file update. ### `IMPORT INTO ... FROM FILE` restrictions @@ -231,7 +231,8 @@ SET GLOBAL tidb_server_memory_limit='75%'; Starting from v8.5.5, when you use [Global Sort](/tidb-global-sort.md), `IMPORT INTO` automatically resolves primary key or unique index conflicts by removing all conflicting rows. -For example, when you import data into a table `create table t(id int primary key, v int);` from the following data file `conflicts.csv`: +For example, when Global Sort is enabled and you import data into a table created with `CREATE TABLE t(id INT PRIMARY KEY, v INT);` from the following data file `conflicts.csv`: + ```csv id,v 1,2 @@ -242,16 +243,17 @@ id,v 4,4 ``` -After import, the table `t` only contains the non-conflicting rows: +After the import, the table `t` contains only the non-conflicting rows: + ```sql -mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8, skip_rows=1; +IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ | Job_ID | Data_Source | Target_Table | Table_ID | Phase | Status | Source_File_Size | Imported_Rows | Result_Message | Create_Time | Start_Time | End_Time | Created_By | +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ | 30001 | s3://mybucket/conflicts.csv | `test`.`t` | 114 | | finished | 24B | 2 | 4 conflicted rows. | 2025-11-28 17:21:40.591023 | 2025-11-28 17:21:41.109977 | 2025-11-28 17:21:44.112506 | root@% | +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ -mysql> select * from t; +SELECT * FROM t; +----+------+ | id | v | +----+------+ @@ -261,7 +263,7 @@ mysql> select * from t; 2 rows in set (0.01 sec) ``` -Details of the conflicted rows are stored in the cloud storage URI. For more information, see the `Conflicted rows info when using Global Sort` section. +Details of the conflicted rows are stored in the cloud storage URI. For more information, see [Conflicted rows information when using Global Sort](#conflicted-rows-information-when-using-global-sort). ### Output @@ -289,12 +291,12 @@ IMPORT INTO t FROM '/path/to/small.csv' WITH DETACHED; +--------+--------------------+--------------+----------+-------+---------+------------------+---------------+----------------+----------------------------+------------+----------+------------+ ``` -#### Conflicted rows info when using Global Sort +#### Conflicted rows information when using Global Sort When you use [Global Sort](/tidb-global-sort.md) and an import job has conflicted rows, the number of conflicted rows is displayed in the `Result_Message` column of [`SHOW IMPORT`](/sql-statements/sql-statement-show-import-job.md), as shown in the following example: ```sql -mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8, skip_rows=1; +IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ | Job_ID | Data_Source | Target_Table | Table_ID | Phase | Status | Source_File_Size | Imported_Rows | Result_Message | Create_Time | Start_Time | End_Time | Created_By | +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ @@ -302,7 +304,7 @@ mysql> import into t from 's3://mybucket/conflicts.csv' with thread=8, skip_rows +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ ``` -You can view the details of the conflicted rows in the `conflicted-rows/` folder of the cloud storage URI. For example: +You can view details of the conflicted rows in the `conflicted-rows/` folder of the cloud storage URI. For example: ``` s3://mybucket/sorted-dir/conflicted-rows/1/1-28f0e03a-27c3-4283-a523-418859bb7a2c/data-1.txt From ac6ad952a4bafbd374b52ff1276130ba46802f84 Mon Sep 17 00:00:00 2001 From: qiancai Date: Wed, 3 Dec 2025 16:04:18 +0800 Subject: [PATCH 10/12] Update sql-statement-import-into.md --- sql-statements/sql-statement-import-into.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 0e78865de3d37..cdb53adfb3116 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -247,12 +247,17 @@ After the import, the table `t` contains only the non-conflicting rows: ```sql IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; +``` + +``` +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ | Job_ID | Data_Source | Target_Table | Table_ID | Phase | Status | Source_File_Size | Imported_Rows | Result_Message | Create_Time | Start_Time | End_Time | Created_By | +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ | 30001 | s3://mybucket/conflicts.csv | `test`.`t` | 114 | | finished | 24B | 2 | 4 conflicted rows. | 2025-11-28 17:21:40.591023 | 2025-11-28 17:21:41.109977 | 2025-11-28 17:21:44.112506 | root@% | +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ +``` +```sql SELECT * FROM t; +----+------+ | id | v | @@ -297,6 +302,9 @@ When you use [Global Sort](/tidb-global-sort.md) and an import job has conflicte ```sql IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; +``` + +``` +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ | Job_ID | Data_Source | Target_Table | Table_ID | Phase | Status | Source_File_Size | Imported_Rows | Result_Message | Create_Time | Start_Time | End_Time | Created_By | +--------+-----------------------------+--------------+----------+-------+----------+------------------+---------------+--------------------+----------------------------+----------------------------+----------------------------+------------+ From c8476c03b461ccbdadcd47458faef83ce6e9f4d2 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Wed, 3 Dec 2025 16:28:01 +0800 Subject: [PATCH 11/12] add "SHOW IMPORT JOBS;" --- sql-statements/sql-statement-import-into.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index cdb53adfb3116..5de8bbfe23a66 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -243,10 +243,14 @@ id,v 4,4 ``` +```sql +IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; +``` + After the import, the table `t` contains only the non-conflicting rows: ```sql -IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; +SHOW IMPORT JOBS; ``` ``` @@ -302,6 +306,7 @@ When you use [Global Sort](/tidb-global-sort.md) and an import job has conflicte ```sql IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; +SHOW IMPORT JOBS; ``` ``` From 2cb4e611bd8029f9effae4ace09ea5a47deee9a3 Mon Sep 17 00:00:00 2001 From: Grace Cai Date: Wed, 3 Dec 2025 16:28:59 +0800 Subject: [PATCH 12/12] Apply suggestions from code review --- sql-statements/sql-statement-import-into.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql-statements/sql-statement-import-into.md b/sql-statements/sql-statement-import-into.md index 5de8bbfe23a66..80fd339a7d923 100644 --- a/sql-statements/sql-statement-import-into.md +++ b/sql-statements/sql-statement-import-into.md @@ -247,7 +247,7 @@ id,v IMPORT INTO t FROM 's3://mybucket/conflicts.csv' WITH THREAD=8, SKIP_ROWS=1; ``` -After the import, the table `t` contains only the non-conflicting rows: +After the import, the table `t` contains only the non-conflicting rows. ```sql SHOW IMPORT JOBS;