# Automatic Transaction Commit Mode

__*AUTOCOMMIT*__

+ By default, the `TiDB` cluster runs in the `AUTOCOMMIT` mode
  + Data Manipulation Language (DMS) statements commit transaction as soon as they are run
  + Each statement is treated as a transaction
+ Check the session autocommit setting by executing **`SELECT @@autocommit`**  
+ Disable the autocommit mode by executing one of the following: 
  + For session: **`SET autocommit = 0`**  
  + For next transaction: **`BEGIN`**  
  + You should end the transaction by executing following statements:
    + To commit the transaction: **`COMMIT`** 
    + To cancel the transaction: **`ROLLBACK`** 
+ Some connectors will disable autocommit by default
  + Connectors are covered in more detail in ***course `201.4 (Java, Python, PHP, ...)`***
------------------------------------------------------------

By default, autocommit mode is enabled.

Due to the limitations of the underlying storage engine, TiDB requires a single row to be no more than 6 MB. All columns of a row are converted to bytes according to their data types and summed up to estimate the size of a single row.

By default, TiDB sets the total size of a single transaction to no more than 100 MB.


Some connectors will disable autocommit by default.
- `https://peps.python.org/pep-0249/#commit`
- `https://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlconnection-autocommit.html`

More details about `autocommit` will be covered in courses 201.4 and 201.5. 
