가장 낮은 격리 수준(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 ;xr
Isolation level set to: READ COMMITTED SCHEMA, READ UNCOMMITTED INSTANCES. |
;autocommit off AUTOCOMMIT IS OFF
SET TRANSACTION ISOLATION LEVEL 1 ;xr
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; ;xr |
|
|
--selecting records from the table SELECT * FROM isol1_tbl; ;xr
=== <Result of SELECT Command> === host_year nation_code =================================== 2008 'AUS'
1 rows selected. |
INSERT INTO isol1_tbl VALUES (2004, 'AUS');
INSERT INTO isol1_tbl VALUES (2000, 'NED'); ;xr
2 rows affected.
/* able to insert new rows even if tran 2 uncommitted */ |
|
|
SELECT * FROM isol1_tbl; ;xr
=== <Result of SELECT Command> === host_year nation_code =================================== 2008 'AUS' 2004 'AUS' 2000 'NED'
3 rows selected.
/* dirty read may occur so that tran_2 can select new rows uncommitted by tran_1 */ |
ROLLBACK; ;xr |
|
|
SELECT * FROM isol1_tbl; ;xr
=== <Result of SELECT Command> === host_year nation_code =================================== 2008 'AUS'
1 rows selected.
/* unrepeatable read may occur so that selected results are different */ |
INSERT INTO isol1_tbl VALUES (1994, 'FRA'); ;xr
DELETE FROM isol1_tbl WHERE nation_code = 'AUS' and host_year=2008; ;xr
1 rows affected. 1 rows affected.
/* able to delete rows while tran 2 is selecting rows*/ |
|
|
SELECT * FROM isol1_tbl; ;xr
=== <Result of SELECT Command> === host_year nation_code =================================== 1994 'FRA'
1 rows selected. |
ALTER TABLE isol1_tbl ADD COLUMN gold INT; ;xr
1 command(s) successfully processed.
/* 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; ;xr |
COMMIT; ;xr |
=== <Result of SELECT Command > === host_year nation_code gold ==================================== 1994 'FRA' NULL
1 rows selected. |