Skip to content

Commit

Permalink
load data: update the notes about committing rows (#15703)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiancai authored Dec 15, 2023
1 parent d79c09f commit 467e37f
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sql-statements/sql-statement-load-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ The syntax of the `LOAD DATA` statement is compatible with that of MySQL, except

> **Note:**
>
> - For versions earlier than TiDB v4.0.0, `LOAD DATA` commits every 20000 rows.
> - For versions from TiDB v4.0.0 to v6.6.0, TiDB commits all rows in one transaction by default.
> - After upgrading from TiDB v4.0.0 or earlier versions, `ERROR 8004 (HY000) at line 1: Transaction is too large, size: 100000058` might occur. The recommended way to resolve this error is to increase the [`txn-total-size-limit`](/tidb-configuration-file.md#txn-total-size-limit) value in your `tidb.toml` file. If you are unable to increase this limit, you can also restore the behavior before the upgrade by setting [`tidb_dml_batch_size`](/system-variables.md#tidb_dml_batch_size) to `20000`. Note that starting from v7.0.0, `tidb_dml_batch_size` no longer takes effect on the `LOAD DATA` statement.
> - For versions earlier than TiDB v4.0.0, `LOAD DATA` commits every 20000 rows, which cannot be configured.
> - For versions from TiDB v4.0.0 to v6.6.0, TiDB commits all rows in one transaction by default. But if you need the `LOAD DATA` statement to commit every fixed number of rows, you can set [`tidb_dml_batch_size`](/system-variables.md#tidb_dml_batch_size) to the desired number of rows.
> - Starting from TiDB v7.0.0, `tidb_dml_batch_size` no longer takes effect on `LOAD DATA`, and TiDB commits all rows in one transaction.
> - After upgrading from TiDB v4.0.0 or earlier versions, `ERROR 8004 (HY000) at line 1: Transaction is too large, size: 100000058` might occur. The recommended way to resolve this error is to increase the [`txn-total-size-limit`](/tidb-configuration-file.md#txn-total-size-limit) value in your `tidb.toml` file.
> - No matter how many rows are committed in a transaction, `LOAD DATA` is not rolled back by the [`ROLLBACK`](/sql-statements/sql-statement-rollback.md) statement in an explicit transaction.
> - The `LOAD DATA` statement is always executed in optimistic transaction mode, regardless of the TiDB transaction mode configuration.
Expand All @@ -165,10 +166,10 @@ The syntax of the `LOAD DATA` statement is compatible with that of MySQL, except

> **Note:**
>
> - For versions earlier than TiDB v4.0.0, `LOAD DATA` commits every 20000 rows.
> - For versions from TiDB v4.0.0 to v6.6.0, TiDB commits all rows in one transaction by default.
> - Starting from TiDB v7.0.0, the number of rows to be committed in a batch is controlled by the `WITH batch_size=<number>` parameter of the `LOAD DATA` statement, which defaults to 1000 rows per commit.
> - After upgrading from TiDB v4.0.0 or earlier versions, `ERROR 8004 (HY000) at line 1: Transaction is too large, size: 100000058` might occur. To resolve this error, you can restore the behavior before the upgrade by setting [`tidb_dml_batch_size`](/system-variables.md#tidb_dml_batch_size) to `20000`.
> - For versions earlier than TiDB v4.0.0, `LOAD DATA` commits every 20000 rows, which cannot be configured.
> - For versions from TiDB v4.0.0 to v6.6.0, TiDB commits all rows in one transaction by default. But if you need the `LOAD DATA` statement to commit every fixed number of rows, you can set [`tidb_dml_batch_size`](/system-variables.md#tidb_dml_batch_size) to the desired number of rows.
> - Starting from v7.0.0, `tidb_dml_batch_size` no longer takes effect on `LOAD DATA`, and TiDB commits all rows in one transaction.
> - After upgrading from TiDB v4.0.0 or earlier versions, `ERROR 8004 (HY000) at line 1: Transaction is too large, size: 100000058` might occur. To resolve this error, you can contact [TiDB Cloud Support](https://docs.pingcap.com/tidbcloud/tidb-cloud-support) to increase the [`txn-total-size-limit`](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#txn-total-size-limit) value.
> - No matter how many rows are committed in a transaction, `LOAD DATA` is not rolled back by the [`ROLLBACK`](/sql-statements/sql-statement-rollback.md) statement in an explicit transaction.
> - The `LOAD DATA` statement is always executed in optimistic transaction mode, regardless of the TiDB transaction mode configuration.
Expand Down

0 comments on commit 467e37f

Please sign in to comment.