Features and concurrency issues deal with things and isolation level

1. Atomicity:

     A thing is an indivisible unit

2. Consistency;

    Thing is to make a database from one consistent state to another consistent state

3. Isolation;

   The implementation of a thing can not be anything else interference

4. endurance:

  Once you have submitted a thing, he changed data in the database should be permanent.

 

mysql transaction processing:

  Only thing innodb database engine supports default innodb database engine, and mysql default execution things, that each have as a SQL transaction processing,

How to manually perform things begin using the keyword display on a thing, use commit or rollback transaction ends.

Second, the problem of concurrent transactions

  1, dirty reads: A transaction B reads the data transaction to update and rollback B, then A read data is dirty data

  2, non-repeatable read: A transaction reads the same data multiple times, transaction transaction A times B in the course of the read, the data were updated and submitted, the transaction A reads the same data multiple times lead, inconsistent results.

  3, Magic Reading: A system administrator will result in the database specific scores for all students from grade ABCDE changed, but the system administrator B would insert a specific record score at this time, when the end of the system administrator A change found there is a record not change overnight, just like happened as hallucinations, this is called phantom reads.

  

Three, MySQL transaction isolation level

Transaction isolation level Dirty read Non-repeatable read Magic Reading
Uncommitted Read (read-uncommitted) Yes Yes Yes
Non-repeatable read (read-committed) no Yes Yes
Repeatable Read (repeatable-read) no no Yes
Serialization (Serializable) no no no

Setting things isolation level;

   set session transation isolation levle xxxx;

Guess you like

Origin blog.csdn.net/song_chengbo/article/details/97613860