문제

According to this articale serializable isolation level performs read lock as well as range lock on rows. So, if in one transaction I perform SELECT statement on some rows(or row), another transactions that will try to query the same rows(or subset of that rows) will lock untill the first one makes a commit or rollback. Right? But in oracle I try to perform such scenario and second transaction have not been locked. Why it doesn't lock until I perform commit in first transaction?

도움이 되었습니까?

해결책

Oracle employs multiversionning to guarantee read-consitency without blocking writes:

Read-consistent queries

The data returned by a query is committed and consistent with respect to a single point in time.

Nonblocking queries

Readers and writers of data do not block one another

When you perform a SELECT in Read-Committed isolation, the database reconstructs the rows as they were at the beginning of the query so that you have a consistent view of the data (all blocks are retrieved at the same point-in-time). Oracle uses undo data to reverse the changes made to the blocks after the query began (also the changes from other uncommited transactions).

The principle is the same with the serializable transaction isolation except that Oracle reconstructs the rows as they were at the beginning of the transaction.

For further reading, I suggest you take a look at the "Multi-Versioning and Concurrency" chapter from one of Tom Kyte's book.

다른 팁

Oracle does not take read locks. They have the CR mechanism.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top