From cf052590087c2b4ebe1b0d58c35b5f857b7a4bdb Mon Sep 17 00:00:00 2001 From: Icemap Date: Thu, 2 Nov 2023 17:44:12 +0800 Subject: [PATCH 1/3] feat: txn limit shift to 1TB --- develop/dev-guide-transaction-restraints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop/dev-guide-transaction-restraints.md b/develop/dev-guide-transaction-restraints.md index 6c180e6d29bf6..947399de7e36a 100644 --- a/develop/dev-guide-transaction-restraints.md +++ b/develop/dev-guide-transaction-restraints.md @@ -710,7 +710,7 @@ 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 configure it by `performance.txn-entry-size-limit` for TiDB v5.0 and later versions. The value is `6 MB` for earlier versions. -- 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 single transaction size supported at maximum is `1 TB`, with a default size of `100 MB`. 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. 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. From 4980c1933f2a55029fb4fccd7938b0c8112b5d85 Mon Sep 17 00:00:00 2001 From: Aolin Date: Mon, 6 Nov 2023 15:24:35 +0800 Subject: [PATCH 2/3] Apply suggestions from code review --- develop/dev-guide-transaction-restraints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/develop/dev-guide-transaction-restraints.md b/develop/dev-guide-transaction-restraints.md index 947399de7e36a..218cf467d6140 100644 --- a/develop/dev-guide-transaction-restraints.md +++ b/develop/dev-guide-transaction-restraints.md @@ -710,7 +710,7 @@ 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 configure it by `performance.txn-entry-size-limit` for TiDB v5.0 and later versions. The value is `6 MB` for earlier versions. -- The single transaction size supported at maximum is `1 TB`, with a default size of `100 MB`. 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 default size of a single transaction is 100 MB and the maximum value is 1 TB, with a default size of 100 MB. 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. 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. From 38bb8892e9c40b38d3767b929326d91a2dc679fa Mon Sep 17 00:00:00 2001 From: Icemap Date: Wed, 8 Nov 2023 00:33:47 +0800 Subject: [PATCH 3/3] update: link to configuration markdown file --- develop/dev-guide-transaction-restraints.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/develop/dev-guide-transaction-restraints.md b/develop/dev-guide-transaction-restraints.md index 218cf467d6140..fdc4d650c629d 100644 --- a/develop/dev-guide-transaction-restraints.md +++ b/develop/dev-guide-transaction-restraints.md @@ -710,7 +710,11 @@ 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 configure it by `performance.txn-entry-size-limit` for TiDB v5.0 and later versions. The value is `6 MB` for earlier versions. -- The default size of a single transaction is 100 MB and the maximum value is 1 TB, with a default size of 100 MB. 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 size of transactions is influenced by different parameters in different versions. + + - In versions below TiDB v4.0, the maximum capacity of a single transaction is `100 MB`. + - In TiDB v4.0 and higher versions, you can adjust it via the tidb-server configuration option [`performance.txn-total-size-limit`](/tidb-configuration-file.md#txn-total-size-limit), with a default value of `100 MB` and a maximum limit of `1 TB`. + - In TiDB v6.5 and higher versions, the maximum capacity of a single transaction is controlled by [memory control](/configure-memory-usage.md) by default. If you manually set `performance.txn-total-size-limit`, you can control the transaction size to a maximum of `1 TB`. 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.