반응형
대용량 테이블에서 Default 값이 설정된 컬럼 추가시 참고
"_add_col_optim_enabled" 설정에 따라
- TRUE(default)
딕셔너리만 업데이트 하고 데이터 블록 변경하지 않음
명시적으로 Not null 조건 필요
Wrong Result 등 버그 이슈 확인 필요 (MOS 문서 ID 1492674.1)
- FALSE
컬럼 추가시 실제 데이터 블록까지 업데이트 수행
작업외 세션들은 library cache lock 대기로 장애 발생 가능성 높음
Nullable로 컬럼 추가 후 -> default 값 modify 방법 수행
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
-- #########################################################
-- Oracle 11g
-- _add_col_optim_enabled + not null 조건 필요
-- #########################################################
alter session set "_add_col_optim_enabled" = false;
alter table big_table add (c1 varchar2(100) default ' ' not null);
-- 220 (sec)
alter session set "_add_col_optim_enabled" = true;
alter table big_table add (c1 varchar2(100) default ' ');
-- 200 (sec)
alter table big_table add (c1 varchar2(100) default ' ' not null);
-- 0.1 (sec)
-- #########################################################
-- Oracle 12c
-- _add_col_optim_enabled + not null 조건 불필요
-- not null 조건이 없이도 빠르게 add default 컬럼 추가 지원
-- #########################################################
alter session set "_add_col_optim_enabled" = false;
alter table big_table add (c1 varchar2(100) default ' ' not null);
-- 220 (sec)
alter session set "_add_col_optim_enabled" = true;
alter table big_table add (c1 varchar2(100) default ' ' not null);
-- 0.03 (sec)
alter table big_table add (c1 varchar2(100) default ' ')
-- 0.03 (sec)
|
cs |
반응형
'[DATABASE] ORACLE > Objects (Table, Index, Etc..)' 카테고리의 다른 글
대용량 Index Rebuild (0) | 2022.06.28 |
---|---|
[LOB] lob type 을 포함한 테이블의 용량 조회 (0) | 2022.04.08 |
[Tablespace] HWM 찾아서 Datafile 줄이기 - 2 (0) | 2021.12.20 |
[Tablespace] HWM 찾아서 Datafile 줄이기 - 1 (0) | 2021.12.20 |
[Index] 인덱스 컬럼 변경(추가,변경) (0) | 2021.12.15 |
댓글