Transaction isolation mechanism

4 isolation levels where transaction isolation exists

  1. Read uncommitted
  2. Read committed
  3. Repeatable read (repeatable read)
  4. Serialized read / serialized read (serializable)

Four interesting ways of transaction isolation, you can test 4 effects by opening two windows under DOS!

				// 设置事务的第 1 种全局隔离级别
				set global transaction isolation level read uncommitted;
				// 查看事务的全局隔离级别
				select @@global.tx_isolation;				
				// 设置事务的第 2 种全局隔离级别
				set global transaction isolation level read committed;
				// 设置事务的第 3 种全局隔离级别
				set global transaction isolation level repeatable read;
				// 设置事务的第 4 种全局隔离级别
				set global transaction isolation level serializable;

4 The first isolation effect is the worst in this isolation mechanism 墙最薄; the fourth isolation effect is the best, 墙最厚
although the fourth isolation effect is good, but the transaction needs to be queued, similar to the principle of Java's thread synchronization

Oracle DBMS default isolation level: read committed (level 2)
MySQL DBMS default isolation level: repeatable read (level 3)

Guess you like

Origin www.cnblogs.com/yerun/p/12733090.html