Just learning MySQL, we may all have heard of things, so what are things?
Things are atomic SQL queries, or an independent unit of work
A very typical example to explain the transaction: bank transfer business
- Check whether the account balance of a is greater than 200;
- Give account a balance -200 yuan;
- Give the account b balance +200 yuan;
This operation is divided into the above three steps, which step cannot be split or interrupted. Once damaged, it may affect the results of the operation and cause errors.
Therefore, a well-functioning transaction processing system must have these transaction standards:
- Atomicity: A thing must be regarded as an indivisible minimum unit of work. All operations in the whole thing must either be submitted successfully or all failed and rolled back;
- Consistency: The database always transitions from a consistent state to another consistent state;
- Isolation: Generally speaking, changes made by a firm are invisible to peculiar transactions before they are finally submitted.
- Persistence: Once the transaction is committed, the changes made will be permanently saved in the database.
The above feature is the ACID concept of transactions.