Detailed ACID of things and affairs

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

  1. Check whether the account balance of a is greater than 200;
  2. Give account a balance -200 yuan;
  3. 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.

Guess you like

Origin blog.csdn.net/weixin_43815275/article/details/114374617