반응형
/****************************************************************************************************************
-- Title : [Database] Description of Transaction Isolation Level
-- Reference : dbrang.tistory.com
-- Key word : transaction 트랜잭션 격리 수준 isolation level read uncommitted committed non repeatable phantom
더티 팬텀
****************************************************************************************************************/
-- Title : [Database] Description of Transaction Isolation Level
-- Reference : dbrang.tistory.com
-- Key word : transaction 트랜잭션 격리 수준 isolation level read uncommitted committed non repeatable phantom
더티 팬텀
****************************************************************************************************************/
● dirty read
- 트랜잭션에서 commit 하지 않은 데이터를 다른 트랜잭션에서 읽는 경우에 발생.
● nonrepeatable read
- commit 하지 않은 트랜잭션의 영향을 받지는 않지만, commit 한 데이터의 값이 다른 트랜잭션에서 영향을 미치게
되는 현상.
● phantom read
- 조건을 만족하는 데이터를 가져왔을 때 다른 트랜잭션에 의하여 질의를 다시 실행 했을때 변경된 데이터가 리턴되는
현상. 없던 데이터가 나타나거나 있던 데이터가 사라질 수도 있다.
※ Read Phenomena in Transaction : dbrang.tistory.com/849
● Isolation Level & Phenomenon
Isolation Level | Dirty Read | Non-Repeatable Read | Pantom Read |
Read Uncommitted | ○ | ○ | ○ |
Read Committed | Ⅹ | ○ | ○ |
Repeatable Read | Ⅹ | Ⅹ | ○ |
Serializable | Ⅹ | Ⅹ | Ⅹ |
● Isolation Level Scenario (▼ Begin Tran; ▼ Commit Tran;)
* PostgreSQL도 허용하지 않는 것으로 보임?
* SQL Server는 After Image에 대한 읽기를 허용함(nolock 힌트시).
* Read Committed라면 Xact B가 commit이 되면서 Xact A의 두번째 select A가 2를 읽는다.
즉, unrepeatable read 발생.
* Lost update 방지.
* Xact A.select A(3~6)의 주변 데이터는 추가되지 못함.
* PK가 설정되어 있어야 부분 Insert가 되고 없으면 테이블 전체에 잠금.
* 하지만 이는 Tempdb에 저장 된 것(SQL Server Only)임.
반응형