20200107-- about affairs

What is a transaction
the transaction: the smallest unit of work database operations, a series of operations as a single logical unit of work performed; these operations as a whole is submitted to the system together, are either executed or not executed; transaction is no longer a group the set of operations (logical unit of work) divided

The four transaction properties of
1, atomic
transaction is a logical unit of work database, each operation transaction contains either do or do not
2, the consistency of
the results of transaction execution must be to a database from one consistent state to change another consistent state. Therefore, when the database contains only the result of a successful transaction commit, say the database in a consistent state. If a failure database system is running, some were forced to interrupt the transaction has not been completed, these transactions did not complete the modifications made to the database has been written to the physical part of the database, then the database will be in a bad state, or is inconsistent state.
3, isolation
execute a transaction can not interfere with other transactions. I.e., operation and use of the data inside a transaction other concurrent transactions are isolated and can not interfere with each other between the respective transaction executed concurrently.
4, persistent
, also known as permanent, refers to a transaction once submitted, change the data in a database it should be permanent. The next operation or other faults should not have any impact on the results.

Irrespective of isolation will produce three major issues
Dirty read: A transaction to read data B uncommitted transaction, resulting in data errors
Non-repeatable read: A transaction read the data B transaction has been submitted, in particular under the scenario will have influence, such as creating uniform data reporting
dummy read (phantom read): a transaction reads data to the newly inserted B transaction has been submitted, the impact of above

The four isolation levels
the Serializable (serialization)
can avoid dirty reads, non-repeatable read, phantom read occurs.

Repeatable read (repeatable read)
can prevent dirty reads, unrepeatable reads occurring.

Read committed (read committed)
to avoid dirty reads to occur.

Read uncommitted (read uncommitted)
the lowest level, in any case can not guarantee

Published 657 original articles · won praise 39 · views 60000 +

Guess you like

Origin blog.csdn.net/qq_36344771/article/details/103883233