# Transaction Size

__*Transactions best practices on TiDB*__

+ Keep transaction size small
+ By default, a transaction is limited to 5000 `SQL` statements
+ By default, each key-value pair entry in `TiKV` cannot exceed 6 MB
+ The total size of key-value pair entries in a transaction cannot exceed 10 GB
+ It is recommended that the number of rows involved per transaction be less than 200, and the size of a single row is less than 100 KB
----------------------------------------------------------------------------------------------------------------------------------------
Distributed transactions require a 2-phase commit and the underlying `Raft` replication, if the transaction is very large, the commit process will be an outstanding performance bottleneck, so the next `Raft` replication process will get stuck. You can find similar restrictions in `Google Cloud Spanner`.

You also need to pay attention to the memory consumption caused by large transaction. In a production environment, it is recommended to split large transactions into small transactions, to some extent, to improve the probability of successful transaction submission and reduce the cost of transaction rollback.