无他,唯手熟尔!

Transaction

Read Uncommitted is the transaction level with the lowest isolation level. Under this isolation level, one transaction reads uncommitted data that was updated by another transaction, and if the other transaction rolls back, the current transaction reads Dirty data, known as a Dirty Read.

Under the Read Committed isolation level, a transaction may encounter a non-repeatable Read problem.

Non-repeatable reads are reads of the same data multiple times within a transaction, and if another transaction happens to modify the data before the end of the transaction, the data read twice in the first transaction may not be consistent.

Under the Repeatable Read isolation level, a transaction may encounter Phantom Read problems.

Phantom read means that in a transaction, the first time a record is queried and no record is found, but when an attempt is made to update the non-existent record, it actually succeeds, and the same record is read again, and it magically appears.

Serializable is the most restrictive isolation level. Under the Serializable isolation level, all transactions are executed in sequence, so dirty reads, non-repeatable reads, and phantom reads do not occur.

While transactions at the Serializable isolation level have the highest security, because transactions are executed serially, there is a significant decrease in efficiency and application performance. If there are no particularly important scenarios, the Serializable isolation level is not typically used.

Default isolation level
If the isolation level is not specified, the database USES the default isolation level. In MySQL, the default isolation level is Repeatable Read if InnoDB is used

赞(0) 打赏
未经允许不得转载:沙の志 » Transaction

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

沙の志