What do you mean business
A transaction is a set of operations units of SQL, either the operation succeeds or all fails.
Acid attribute atomicity (atomicity)
A thing must be considered as an inseparable minimum unit of work, the entire transaction either succeeds or all fails to roll back, and for one thing, it is impossible to perform only a subset of the operations.
Consistency (consistency)
The database is always transitioning from one consistent state to another consistent state. For example, for a total of two update, after the first update, the system crashes and does not affect the data because the transaction is not committed.
Isolation (Isolation)
Changes made by a firm are not visible to other transactions until they are finally committed.
Persistence (Durability)
Once the transaction commits, the modifications are persisted to the database.
Transaction ISOLATION LEVEL
Problems with concurrent transactions:
- Dirty Read
A transaction can read uncommitted data, called dirty reads.
- Non-REPEATABLE READ
At the beginning of a transaction, only the modifications that have been submitted to the firm are read. In other words, any changes you make to a transaction from the beginning until it is committed are not visible to other transactions. Performing the same query two times may result in a different outcome.
- Phantom reading
Refers to when a transaction reads a range of records, another transaction inserts a new record within that scope, and when the previous transaction reads the record for that range again, a magic line is generated.
| Isolation Level |
Dirty Read Possibility |
non-repeatable reading possibilities |
Phantom Reading Possibilities |
| READ UNCOMMITTED |
Yes |
Yes |
No |
| Read Committed |
No |
Yes |
Yes |
| REPEATABLE READ |
No |
No |
Yes |
| Serializable |
No |
No |
No |
Things and isolation levels in MySQL