Database transaction isolation levels and spread

Database transaction isolation levels and spread

mysql support in 4 isolation level, the default "repeatable read" isolation level.

oracle default only supports "Read Committed" and serial isolation level, the default "Read Committed."

Isolation: isolation level

Isolation level refers to the degree of isolation between the number of concurrent transactions, primarily associated with our development time scenarios include: dirty reads, repeatable read, phantom read.

The DEFAULT : This is the default, use the default isolation level of the underlying database. For most databases, usually this value is: READ_COMMITTED.
READ_UNCOMMITTED : This represents a transaction isolation level data can be read another transaction modified but not yet committed. This level can not prevent dirty reads and non-repeatable read, the isolation level is rarely used.
READ_COMMITTED : The isolation level represents a transaction can only read data another transaction has been submitted. This level prevents dirty reads, which is the recommended value in most cases.
REPEATABLE_READ : This represents a transaction isolation level in the whole process can be repeatedly execute a query, and each returned record are the same. Even in the new data to satisfy the query between multiple queries, these new records will be ignored. The levels prevent dirty reads and non-repeatable read.
SERIALIZABLE : All transactions executed one by one in sequence, it is impossible to produce interference between such matters, that is to say, this level prevents dirty reads, non-repeatable reads and phantom reads. But this will seriously affect the performance of the program. Under normal circumstances you do not need this level.

Propagation: propagation behavior

The so-called spread behavior of affairs means that if before the start of the current transaction, a transaction context already exists, then there are several options you can specify execution behavior of a transactional approach.

REQUIRED: If the current transaction exists, it is added to the transaction; if no transaction, create a new business.
SUPPORTS: If the current transaction exists, it is added to the transaction; if no transaction, non-transactional way places continue to run.
MANDATORY: If the current transaction exists, it is added to the transaction; if no transaction, an exception is thrown.
REQUIRES_NEW: Create a new transaction, if the current transaction exists, put the current transaction pending.
NOT_SUPPORTED: Running in non-transactional way, if the current transaction exists, put the current transaction pending.
NEVER: Running in non-transactional way, if the current transaction exists, an exception is thrown.
NESTED: If the current transaction exists, create a transaction to run as the current nested transaction transaction; if no transaction, the value is equivalent to REQUIRED.

Guess you like

Origin www.cnblogs.com/aric2016/p/12125649.html