Skip to content

Commit

Permalink
txn: fix the maximum value of a transaction from 10GB to 1 TiB (#19091)…
Browse files Browse the repository at this point in the history
… (#19102)
  • Loading branch information
ti-chi-bot authored Oct 12, 2024
1 parent 8bda02b commit aa6eb20
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions develop/dev-guide-transaction-restraints.md
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,12 @@ mysql> SELECT * FROM T2;

The basic principle is to limit the size of the transaction. At the KV level, TiDB has a restriction on the size of a single transaction. At the SQL level, one row of data is mapped to one KV entry, and each additional index will add one KV entry. The restriction is as follows at the SQL level:

- The maximum single row record size is `120 MB`. You can adjust it by using the `performance.txn-entry-size-limit` configuration parameter of tidb-server for TiDB v4.0.10 and later v4.0.x versions, TiDB v5.0.0 and later versions. The value is `6 MB` for versions earlier than v4.0.10.
- The maximum single transaction size supported is `10 GB`. You can configure it by `performance.txn-total-size-limit` for TiDB v4.0 and later versions. The value is `100 MB` for earlier versions.
- The maximum single row record size is 120 MiB. You can adjust it by using the [`performance.txn-entry-size-limit`](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#txn-entry-size-limit-new-in-v4010-and-v500) configuration parameter of tidb-server for TiDB v4.0.10 and later v4.0.x versions, TiDB v5.0.0 and later versions. The value is `6 MB` for versions earlier than v4.0.10.

- The maximum single transaction size supported is 1 TiB.

- For TiDB v4.0 and later versions, You can configure it by [`performance.txn-total-size-limit`](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#txn-total-size-limit)). The value is `100 MB` for earlier versions.
- For TiDB v6.5.0 and later versions, this configuration is no longer recommended. For more information, see [`performance.txn-total-size-limit`](https://docs.pingcap.com/tidb/stable/tidb-configuration-file#txn-total-size-limit)).

Note that for both the size restrictions and row restrictions, you should also consider the overhead of encoding and additional keys for the transaction during the transaction execution. To achieve optimal performance, it is recommended to write one transaction every 100 ~ 500 rows.

Expand Down

0 comments on commit aa6eb20

Please sign in to comment.