가장 낮은 격리 수준(1)으로서 동시성이 가장 높다. 행에 대해서는 더티 읽기, 반복 불가능한 읽기, 유령 읽기가 발생할 수 있고, 테이블에 대해서도 반복 불가능한 읽기가 발생할 수 있다. 위에서 설명한 REPEATABLE READ CLASS with READ UNCOMMITTED INSTANCES(수준 3)와 유사하지만, 테이블 스키마에 대해서는 다르게 동작한다. 즉, 트랜잭션 T1이 조회 중인 테이블에 대해 다른 트랜잭션 T2가 스키마를 변경할 수 있으므로, 테이블 스키마 갱신에 의한 반복 불가능한 읽기가 발생할 수 있다.
다음과 같은 규칙이 적용된다.
이 격리 수준은 배타 및 갱신 잠금에 대해서는 2단계 잠금을 따른다. 하지만 행에 대한 공유 잠금은 행이 조회된 직후 바로 해제된다. 또한, 테이블에 대한 의도 잠금도 조회 직후 바로 해제된다.
session 1 |
session 2 |
---|---|
;autocommit off AUTOCOMMIT IS OFF
SET TRANSACTION ISOLATION LEVEL 1;
Isolation level set to: READ COMMITTED SCHEMA, READ UNCOMMITTED INSTANCES. |
;autocommit off AUTOCOMMIT IS OFF
SET TRANSACTION ISOLATION LEVEL 1;
Isolation level set to: READ COMMITTED SCHEMA, READ UNCOMMITTED INSTANCES. |
--creating a table
CREATE TABLE isol1_tbl(host_year integer, nation_code char(3)); CREATE UNIQUE INDEX on isol1_tbl(nation_code, host_year); INSERT INTO isol1_tbl VALUES (2008, 'AUS');
COMMIT; |
|
|
--selecting records from the table SELECT * FROM isol1_tbl; host_year nation_code =================================== 2008 'AUS' |
INSERT INTO isol1_tbl VALUES (2004, 'AUS');
INSERT INTO isol1_tbl VALUES (2000, 'NED');
/* able to insert new rows even if tran 2 uncommitted */ |
|
|
SELECT * FROM isol1_tbl; host_year nation_code =================================== 2008 'AUS' 2004 'AUS' 2000 'NED'
/* dirty read may occur so that tran_2 can select new rows uncommitted by tran_1 */ |
ROLLBACK; |
|
|
SELECT * FROM isol1_tbl; host_year nation_code =================================== 2008 'AUS'
/* unrepeatable read may occur so that selected results are different */ |
INSERT INTO isol1_tbl VALUES (1994, 'FRA');
DELETE FROM isol1_tbl WHERE nation_code = 'AUS' and host_year=2008;
/* able to delete rows while tran 2 is selecting rows*/ |
|
|
SELECT * FROM isol1_tbl; host_year nation_code =================================== 1994 'FRA' |
ALTER TABLE isol1_tbl ADD COLUMN gold INT;
/* able to alter the table schema even if tran 2 is uncommitted yet*/ |
|
|
/* unrepeatable read may occur so that result shows different schema */
SELECT * FROM isol1_tbl; |
COMMIT; |
host_year nation_code gold ==================================== 1994 'FRA' NULL |