DROP TABLE APPEND_TEST CASCADE CONSTRAINTS PURGE;
;
CREATE TABLE APPEND_TEST AS
SELECT 1 AS SKEWED_DATA
, LPAD(ROWNUM-1,10) AS ID
, TRUNC(SQRT(ROWNUM-1)) AS ID_CHAR
, RPAD('X',50, 'X') AS FILLER
FROM ALL_OBJECTS
WHERE 1=0;
CREATE INDEX APPEND_TEST_01 ON APPEND_TEST(ID_CHAR);
CREATE UNIQUE INDEX APPEND_TEST_PK ON APPEND_TEST(ID);
ALTER TABLE APPEND_TEST ADD CONSTRAINT PK_APPEND_TEST PRIMARY KEY (ID);
ALTER SESSION SET SKIP_UNUSABLE_INDEXES=TRUE;
ALTER INDEX APPEND_TEST_PK UNUSABLE;
ALTER INDEX APPEND_TEST_01 UNUSABLE;
ALTER TABLE APPEND_TEST DISABLE PRIMARY KEY;
INSERT /*+ APPEND */
INTO APPEND_TEST
SELECT 1 AS SKEWED_DATA
, LPAD(ROWNUM-1,10) AS ID
, TRUNC(SQRT(ROWNUM-1)) AS ID_CHAR
, RPAD('X',50, 'X') AS FILLER
FROM ALL_OBJECTS
WHERE ROWNUM <= 10;
SELECT INDEX_NAME
, UNIQUENESS
, STATUS
FROM USER_INDEXES
WHERE TABLE_NAME = UPPER('APPEND_TEST');
TRUNCATE TABLE APPEND_TEST;
ALTER SESSION SET SKIP_UNUSABLE_INDEXES=FALSE;
ALTER TABLE APPEND_TEST ENABLE PRIMARY KEY;
ALTER INDEX APPEND_TEST_PK REBUILD;
ALTER INDEX APPEND_TEST_01 REBUILD
'wif LiNoUz > Oracle,Sql' 카테고리의 다른 글
Oracle Disable Constraints and Make Indexes Unusable (1) | 2015.06.03 |
---|---|
INDEX_SKIP 예제 (0) | 2015.05.26 |
index, table , segment 크기 예측 (0) | 2015.03.05 |
[DB 성능관리 2% 채우기] ③ 프로그래밍 통한 성능개선 사례 (0) | 2015.01.23 |
[DB 성능관리 2% 채우기] ① 자동화 툴의 한계 (0) | 2015.01.23 |