Transaction control
In general, MySQL turns on the transaction autocommit feature by default, and each SQL execution commits the transaction. You can turn off the transaction autocommit feature by using the following statement.
Show session variables like ' autocommit ', set @ @autocommit = 0;show Session variables like ' autocommit ';
1. Start of transaction
Begin or start transaction;
2. Transaction Submission
Commit or commit work;
3. Rollback
Rollback or rollback work;
4, Save point settings
SavePoint identification;
5. Roll back to SavePoint
Rollback to SavePoint logo;
6. Delete the savepoint
Release savepoint identification.
Transaction isolation
read-uncommitted READ UNCOMMITTED
Read-committed Read submitted
Repeatable-read Repeat Read
Serialization of SERIALIZABLE
|
Dirty Read |
Non-stressed |
Phantom reading |
read-uncommitted |
Y |
Y |
Y |
read-committed |
N |
Y |
Y |
Repeatable-read |
N |
N |
Y |
SERIALIZABLE |
N |
N |
N |
Dirty reads: Reading data is another transactional process data, and reading it may be wrong.
Non-stressed: the second read data content is different from the first read data content. (No read transaction process data exists)
Phantom reads: The number of rows of data read the second time is more or less than the first read. (No read transaction process data exists)
MySQL Transaction (ii)--Control statement usage