์ถ์ฒ : http://a07274.tistory.com/227
( ์ค๋ผํด ์ฌ์ดํธ์์ ์ข ๋ ์์ธํ ์ฌํญ์ ํ์ธํ๊ณ ์ถ์ ๋ถ๋ค์ ์ด๊ณณ์ ์ด์ฉํ๋ฉด๋๋ค. )
I. ์ค๋ผํด ํํฐ์
์ ์
1. ํํฐ์
๊ฐ์
์ค๋๋ ๊ธฐ์
์์ ๊ด๋ฆฌํ๋ ๋ฐ์ดํฐ๋ ์๋ฐฑํ
๋ผ ๋ฐ์ดํธ์ ์ด๋ฅด๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ๊ด๋ฆฌํ๋ค.
ํ์ง๋ง ์ด๋ฐ ๋ฐ์ดํฐ๋ค ์ค ๋ช๋ช์ Big Transaction Table์ด ๊ฑฐ์ ๋ชจ๋ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง๊ณ ์๊ณ
๋๋จธ์ง ํ
์ด๋ธ๋ค์ ์ด Big Transaction Table์ ๊ฒฝ์ ํ์ฌ ์ก์ธ์ค ํ๋ ์ฉ๋๋ก ์ฌ์ฉ๋๋ค.
์ด๋ ๊ฒ ๋ฐ์ดํฐ ํฌ๊ธฐ๋ ํฌ๊ณ ์ค์ํ Big Transaction Table์ ๊ด๋ฆฌํ๋ ๋ถ๋ถ์์ Troubleshooting์ด
๋ฐ์๋ ๊ฒฝ์ฐ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฑ๋ฅ ๋ฐ ๊ด๋ฆฌ์์
์ ์ฌ๊ฐํ ์ํฅ์ ๋ฐ์ ์ ์๋ค.
์ด๋ฌํ ๋ฆฌ์คํฌ๊ฐ ์๋ Big Transaction Table์ ๋ณด๋ค ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํ๊ธฐ ์ํด Table์
์์ ๋จ์๋ก ๋๋์ผ๋ก์จ ๋ฐ์ดํฐ ์ก์ธ์ค ์์
์ ์ฑ๋ฅ ํฅ์์ ์ ๋ํ๊ณ ๋ฐ์ดํฐ ๊ด๋ฆฌ๋ฅผ ๋ณด๋ค
์์ํ๊ฒ ํ๊ณ ์ ํ๋ ๊ฐ๋
์ด๋ค.
2. ํํฐ์
ํ
์ด๋ธ์ ์ฅ์
1) ๊ฐ์ ๋ ๊ฐ์ฉ์ฑ
- ํํฐ์
์ ๋
๋ฆฝ์ ์ผ๋ก ๊ด๋ฆฌ๋๋ค.
- Backup and Restore๋ฅผ ํํฐ์
๋ณ๋ก ์์
ํ ์ ์๋ค.
- ๊ฐ์ ํ
์ด๋ธ์์ Unavailableํ ํํฐ์
์ ๋ค๋ฅธ ํํฐ์
์ ์ํฅ์ ์ฃผ์ง ์๋๋ค.
2) ๊ด๋ฆฌ์ ์ฉ์ด์ฑ
- ์ฌ์ฉ์๊ฐ ์ง์ ํ ๊ฐ์ผ๋ก ํํฐ์
์ด ๊ฐ๋ฅํ๋ค.
- ํ
์ด๋ธ์คํ์ด์ค๊ฐ์ ํํฐ์
์ด๋์ด ๊ฐ๋ฅํ๋ค.
- ํํฐ์
๋ ๋ฒจ์์ Select, Delete, Update๊ฐ ๊ฐ๋ฅํ๋ค.
3) ๊ฐ์ ๋ ์ฑ๋ฅ
- ๋ฐ์ดํฐ๋ฅผ ์ก์ธ์คํ ๋ ์ก์ธ์คํ๋ ๋ฒ์๋ฅผ ์ค์ฌ ํผํฌ๋จผ์ค ํฅ์์ ๊ฐ์ ธ์ฌ ์ ์๋ค.
- RAC(Real Application Clusters) ํ๊ฒฝ์์ ์ธ์คํด์ค๊ฐ Block Contention์ ๊ฐ์์ํจ๋ค.
3. ํํฐ์
ํ
์ด๋ธ ์ฌ์ฉ์ ์ฃผ์ํ ์
1) ๊ด๋ฆฌ์ ์ธ ๊ด์
- ํ๋์ ํ
์ด๋ธ์ ์ธ๋ถํํ์ฌ ๊ด๋ฆฌํ๊ธฐ ๋๋ฌธ์ ๋ณด๋ค ์ธ์ฌํ ๊ด๋ฆฌ๊ฐ ์๊ตฌ๋๋ค.
- ํํฐ์
์ ์ ๋ชป ๊ตฌ์ฑ ๋๋ ๊ด๋ฆฌํ์ฌ IU(Index Unusable)์ ๋น ์ง๋ ๊ฒ์ ์ฃผ์ํด์ผ ํ๋ค.
2) ์ฌ์ฉํ๋ ๊ด์
- ํํฐ์
ํค๋ก ๋๋์ด์ ธ ์๋ ํ
์ด๋ธ์ ํํฐ์
ํค๋ฅผ ์กฐ๊ฑด์ผ๋ก ์ฃผ์ง ์์ ์ ์ฒด ํํฐ์
์ ์ก์ธ์คํ์ง
์๋๋ก ์ฃผ์ํด์ผ ํ๋ค.
4. ํํฐ์
ํ
์ด๋ธ์ ํน์ง
- ํํฐ์
ํ
์ด๋ธ์ ํํฐ์
ํค ๊ฐ์ ์ํด ๊ตฌ์ฑ๋๋ฉฐ, ํ ํ
์ด๋ธ ๋น ๊ฐ๋ฅํ ํํฐ์
์ ์ด๋ก ์ ์ผ๋ก 65,535๊ฐ๋ฅผ
์ง์ํ๋ ์ค์ง์ ์ผ๋ก๋ 10,000๊ฐ๊น์ง๋ง ์์ฑ ๊ฐ๋ฅํ๋ค(Oracle Ver 10.2.0.3 ํ
์คํธ)
- ๋ชจ๋ ํํฐ์
ํ
์ด๋ธ(๋๋ ์ธ๋ฑ์ค)๋ ๊ฐ์ Logical Attribute๋ฅผ ๊ฐ์ ธ์ผ ํ๋ค.
Ex) Columns, Data Types, Constraints...
- ๋ชจ๋ ํํฐ์
ํ
์ด๋ธ(๋๋ ์ธ๋ฑ์ค)๋ ๋ค๋ฅธ Physical Attribute๋ฅผ ๊ฐ์ ธ์ผ ํ๋ค.
Ex) PCTFREE, PCTUSED, INITTRANS, MAXTRANS, TABLESPACE, STORAGE...
- ํํฐ์
ํ
์ด๋ธ์ 'KEY', 'VALUES LESS THAN Literal', 'Physical Attributes'๋ก ๊ตฌ์ฑ๋๋ค.
- 'VALUES LESS THAN Literal' ์ ์์ 'Literal' ๊ฐ์๋ SQL Function์ ์ง์ํ๋ค.
- Composite Column ๊ตฌ์ฑ์ 16๊ฐ๊น์ง ๊ฐ๋ฅํ๋ค.
II. ํํฐ์
์ข
๋ฅ
1. Oracle ๋ฒ์ ์ ๋ฐ๋ฅธ ํํฐ์
1) Oracle Ver 7.3
- Partition View๋ฅผ ์ฒ์์ผ๋ก ๋์
ํ์๋ค.
- ๋น์ Partition View๋ ํฐ ํ
์ด๋ธ์ ๋์ผํ ํ
ํ๋ฆฟ์ ๊ฐ์ง ์ฌ๋ฌ ๊ฐ์ ๋ค๋ฅธ ํ
์ด๋ธ๋ก ๋ถํ ํ๊ณ
UNION ALL์ ์ฌ์ฉํ์ฌ View๋ก ๋ฌถ์ ํํ์ด๋ค.
- ๊ทธ๋ฌ๋ ์ด ๋ฐฉ์์ ๊ด๋ฆฌ์ ์ด๋ ค์, ํ์ฉ์ฑ์ ๋ถ์กฑ, ์ฑ๋ฅ๋ฑ์ ๋ํ ์ด์๋ก ์ธํ์ฌ Oracle Ver 9i์์๋
๋์ด์ ์ง์ํ์ง ์๋๋ค.
2) Oracle Ver 8.0
- ์ปฌ๋ผ ๊ฐ์ Range ๊ธฐ๋ฐ์ผ๋ก ๋ Range Partition์ด ์ต์ด๋ก ๋์
๋์๊ณ , ๋น๋ก์ Partition์ ๋ชจ์ต์ ๊ฐ์ถ์๋ค.
- ๊ฐ ํํฐ์
์ ๊ฐ๊ธฐ ๋ค๋ฅธ ํ
์ด๋ธ ์คํ์ด์ค, Segment์ ์ ์ฅ์ด ๊ฐ๋ฅํ๋ค.
3) Oracle Ver 8i
- ์ปฌ๋ผ ๊ฐ์ Hash ๊ธฐ๋ฐ์ผ๋ก ๋ hash partition๊ณผ, Sub Partition์ ํ ์ ์๋ Composite Partition์ด ์ถ๊ฐ๋์๋ค.
- ์ด ๋น์ Composite Partition์ Range-Hash๋ก๋ง ๊ตฌ์ฑ ๊ฐ๋ฅํจ.
4) Oracle Ver 9i
- ๋ฆฌ์คํธ ๊ฐ์ผ๋ก ํํฐ์
์ ํ ์ ์๋ List Partition์ด ์ถ๊ฐ๋์๋ค.
- Composite Partition์์๋ Range-Hash ์ด์ธ์ Range-List๊ฐ ์ถ๊ฐ ์ง์๋์๋ค.
5) Oracle Ver 10g
- IOT ํํฐ์
์ด ์ถ๊ฐ๋์๋ค.
6) Oracle Ver 11g
- Composite Partition์์ ํ์ฅ๋ Extended Composite Partition์ด ์ง์๋๋ค.
-> Range-Range, List-Range, List-Hash, List-List
- Reference Partition ์ถ๊ฐ
- Interval Partition ์ถ๊ฐ
- System Partition ์ถ๊ฐ
- Virtual Column Partition ์ถ๊ฐ
2. Partition Table
1) Range Partition
- Column Value์ ๋ฒ์๋ฅผ ๊ธฐ์ค์ผ๋ก ํ์ฌ ํ์ ๋ถํ ํ๋ ํํ์ด๋ค.
- Range Partition์์ Table์ ๋จ์ง ๋
ผ๋ฆฌ์ ์ธ ๊ตฌ์กฐ์ด๋ฉฐ ์ค์ ๋ฐ์ดํฐ๊ฐ ๋ฌผ๋ฆฌ์ ์ผ๋ก ์ ์ฅ๋๋ ๊ณณ์
Partition์ผ๋ก ๋๋์ด์ง Tablespace์ ์ ์ฅ์ด ๋๋ค.
- PARTITION BY RANGE ( column_list ) : ๊ธฐ๋ณธ Table์์ ์ด๋ Column์ ๊ธฐ์ค์ผ๋ก ๋ถํ ํ ์ง๋ฅผ ์ ํจ.
VALUES LESS THAN ( value_list ) : ๊ฐ Partition์ด ์ด๋ค ๊ฐ์ ๋ฒ์๋ฅผ ํฌํจ ํ ์ง Upper Bound๋ฅผ ์ ํจ.
- ๊ตฌ๋ฌธ Sample
CREATE TABLE SALES_DATA_2008
(
COLUMN_1 NUMBER NOT NULL,
COLUMN_2 VARCHAR2(4),
COLUMN_3 VARCHAR2(4),
COLUMN_4 VARCHAR2(2),
COLUMN_5 VARCHAR2(2),
COLUMN_6 NUMBER
)
TABLESPACE TABLE_SPACE_DATA_1
PCTFREE 5
PCTUSED 40
INITRANS 11
MAXTRANS 255
STORAGE
(
INITIAL 2048K
NEXT 1024K
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 121
)
PARTITION BY RANGE ( COLUMN_3, COLUMN_4, COLUMN_5 )
(
PARTITION P_200801 VALUES LESS THAN ('2008', '04', '01' ),
PARTITION P_200802 VALUES LESS THAN ('2008', '07', '01' ),
PARTITION P_200803 VALUES LESS THAN ('2008', '10', '01' ),
PARTITION P_200804 VALUES LESS THAN ('2009', '01', '01' ),
PARTITION P_5 VALUES LESS THAN (MAXVALUE)
TABLESPACE TABLE_SPACE_DATA_2
PCTFREE 5
PCTUSED 40
INITRANS 11
MAXTRANS 255
STORAGE
(
INITIAL 1M
NEXT 1M
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 121
);
2) Hash Partition
- Partitioning column์ Partitioning Key ๊ฐ์ Hash ํจ์๋ฅผ ์ ์ฉํ์ฌ Data๋ฅผ ๋ถํ ํ๋ ๋ฐฉ์.
- ๋ฐ์ดํฐ ์ด๋ ฅ๊ด๋ฆฌ์ ๋ชฉ์ ๋ณด๋ค ์ฑ๋ฅ ํฅ์์ ๋ชฉ์ ์ผ๋ก ๋์จ ๊ฐ๋
์ด๋ค.
Hash Partition์ Range Partition์์ ๋ฒ์๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋๋์์ ๊ฒฝ์ฐ ํน์ ๋ฒ์์ ๋ถํฌ๋๊ฐ ๋ชฐ๋ ค์
- ๊ฐ๊ธฐ Size๊ฐ ๋ค๋ฅด๊ฒ ๋๋ ๊ฒ์ ๋ณด์ํ์ฌ, ์ผ์ ํ ๋ถํฌ๋ฅผ ๊ฐ์ง ํํฐ์
์ผ๋ก ๋๋๊ณ ๊ท ๋ฑํ ๋ฐ์ดํฐ ๋ถํฌ๋๋ฅผ
์ด์ฉํ ๋ณ๋ ฌ์ฒ๋ฆฌ๋ก ํผํฌ๋จผ์ค๋ฅผ ๋ณด๋ค ํฅ์์ํฌ ์ ์๋ค.
- Hash Partition์์ Table์ ๋จ์ง ๋
ผ๋ฆฌ์ ์ธ ๊ตฌ์กฐ์ด๋ฉฐ ์ค์ ๋ฐ์ดํฐ๊ฐ ๋ฌผ๋ฆฌ์ ์ผ๋ก ์ ์ฅ๋๋ ๊ณณ์
Partition์ผ๋ก ๋๋์ด์ง Tablespace์ ์ ์ฅ์ด ๋๋ค.
- ๊ตฌ๋ฌธ Sample
CREATE TABLE SALES_DATA_2008
(
COLUMN_1 NUMBER NOT NULL,
COLUMN_2 VARCHAR2(4),
COLUMN_3 VARCHAR2(4),
COLUMN_4 VARCHAR2(2),
COLUMN_5 VARCHAR2(2),
COLUMN_6 NUMBER
)
TABLESPACE TABLE_SPACE_DATA_1
PCTFREE 5
PCTUSED 40
INITRANS 11
MAXTRANS 255
STORAGE
(
INITIAL 2048K
NEXT 1024K
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 121
)
PARTITION BY HASH ( COLUMN_3, COLUMN_4, COLUMN_5 )
(
PARTITION P_200801,
PARTITION P_200802,
PARTITION P_200803,
PARTITION P_200804,
PARTITION P_5 VALUES LESS THAN (MAXVALUE)
)
);
3) Composite(Sub) Partition
- ํํฐ์
์ ์ปฌ๋ผ์ Main-Sub ๊ด๊ณ๋ก ๋๋์ด ๋ถํ ํ๋ ๋ฐฉ์.
- Composite Partition์ด ์๋ ๋ค๋ฅธ ํํฐ์
์์ ๋ฌผ๋ฆฌ์ ์ธ ๋ฐ์ดํฐ๊ฐ ์ ์ฅ๋๋ ๊ณณ์ Table์ด ์๋
Partition Table์ ์ ์ฅ์ด ๋๋ ๊ฒ์ฒ๋ผ, Composite Partition์์๋ Main Partition์ด ์๋
Sub Partition์ ์ ์ฅ๋๋ค.
- Composite Partition์ ์กฐํฉ ๊ตฌ์ฑ์ Oracle์ ๋ฒ์ ์ด ์ฌ๋ผ๊ฐ์๋ก ์กฐํฉํ๋ ๋ฐฉ์์ ๋ค์ํ๊ฒ ์ง์ํ๋ค.
- ๊ตฌ๋ฌธ Sample
CREATE TABLE SALES_DATA_2008
(
COLUMN_1 NUMBER NOT NULL,
COLUMN_2 VARCHAR2(4),
COLUMN_3 VARCHAR2(4),
COLUMN_4 VARCHAR2(2),
COLUMN_5 VARCHAR2(2),
COLUMN_6 NUMBER
)
TABLESPACE TABLE_SPACE_DATA_1
PCTFREE 5
PCTUSED 40
INITRANS 11
MAXTRANS 255
STORAGE
(
INITIAL 2048K
NEXT 1024K
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 121
)
PARTITION BY RANGE ( COLUMN_3, COLUMN_4 )
SUBPARTITION BY HASH ( COLUMN_5 )
(PARTITION P_200801 VALUES LESS THAN ('2008', '04'),
PARTITION P_200802 VALUES LESS THAN ('2008', '07'),
PARTITION P_200803 VALUES LESS THAN ('2008', '10')
(SUBPARTITIONS P_200803_S1 TABLESPACE TABLE_SPACE_DATA_1_1,
SUBPARTITIONS P_200803_S2 TABLESPACE TABLE_SPACE_DATA_1_2,
SUBPARTITIONS P_200803_S3 TABLESPACE TABLE_SPACE_DATA_1_3,
SUBPARTITIONS P_200803_S4 TABLESPACE TABLE_SPACE_DATA_1_4,
SUBPARTITIONS P_200803_S5 TABLESPACE TABLE_SPACE_DATA_1_5,
SUBPARTITIONS P_200803_S6 TABLESPACE TABLE_SPACE_DATA_1_6,
SUBPARTITIONS P_200803_S7 TABLESPACE TABLE_SPACE_DATA_1_7,
SUBPARTITIONS P_200803_S8 TABLESPACE TABLE_SPACE_DATA_1_8
),
PARTITION P_200804 VALUES LESS THAN ('2009', '01')
);
4) List Partition
- Partitioning column์ ํน์ ๊ฐ์ผ๋ก ๋ถํ ํ๋ ๋ฐฉ์
- ๋ฐ์ดํฐ ๋ถํฌ๋๊ฐ ๋ฎ์ง ์๊ณ , ๊ท ๋ฑํ๊ฒ ๋ถํฌ๋์ด ์์ ๋ ์ ์ฉํ๋ค.
- Composite Partition์์ 'Range-List'์ผ ๊ฒฝ์ฐ ๊ทธ ํจ์จ์ด ๋์ฑ ๋์์ง๋ค.
- ๋ค๋ฅธ ํํฐ์
๋ฐฉ์์ฒ๋ผ ๋ค์ค ์ปฌ๋ผ์ ์ง์ํ์ง ์๊ณ ๋จ์ผ ์ปฌ๋ผ๋ง ๊ฐ๋ฅํ๋ค.
- ๊ตฌ๋ฌธ Sample
CREATE TABLE SALES_DATA_2008
(
COLUMN_1 NUMBER NOT NULL,
COLUMN_2 VARCHAR2(4),
COLUMN_3 VARCHAR2(4),
COLUMN_4 VARCHAR2(2),
COLUMN_5 VARCHAR2(2),
COLUMN_6 NUMBER
)
TABLESPACE TABLE_SPACE_DATA_1
PCTFREE 5
PCTUSED 40
INITRANS 11
MAXTRANS 255
STORAGE
(
INITIAL 2048K
NEXT 1024K
PCTINCREASE 0
MINEXTENTS 1
MAXEXTENTS 121
)
PARTITION BY LIST(COLUMN_2)
(
PARTITION RS VALUES('A') TABLESPACE TABLE_SPACE_DATA_2,
PARTITION RM VALUES('B') TABLESPACE TABLE_SPACE_DATA_3,
PARTITION RN VALUES('C') TABLESPACE TABLE_SPACE_DATA_4,
);
5) Reference Partition
- Reference Key๋ก ์ง์ ๋ ๊ฒฝ์ฐ ๋ถ๋ชจ ํ
์ด๋ธ์ ์ปฌ๋ผ์ด ์กด์ฌํ์ง ์์๋ ๋ถ๋ชจ์ Partition Key๋ก
๋ถํ ํ๋ ๋ฐฉ์.
- ๊ตฌ๋ฌธ Sample
CREATE TABLE CUSTOMERS
(
CUST_ID NUMBER PRIMARY KEY,
CUST_NAME VARCHAR2(200),
RATING VARCHAR2(1) NOT NULL
)
PARTITION BY LIST(RATING)
(
PARTITION PA VALUES('A'),
PARTITION PB VALUES('B')
);
-- Detail Table
CREATE TABLE SALES
(
SALES_ID NUMBER PRIMARY KEY,
CUST_ID NUMBER NOT NULL,
SALES_AMT NUMBER,
CONSTRAINT FK_SALES_01 FOREIGN KEY (CUST_ID) REFERENCES CUSTOMERS
)
PARTITION BY REFERENCE (FK_SALES_01);
- ์ ์ฝ์กฐ๊ฑด
-> Foreign Key ์ ์ฝ์กฐ๊ฑด์ด ์ค์ ๋์ด ์์ด์ผ ํ๋ค.
-> ์์๋ฐ๋ ํ
์ด๋ธ์ Key๊ฐ์ด NOT NULL ์ด์ด์ผ ํ๋ค.
- ํ
์คํธ
-- Normal
SELECT *
FROM SALE_TMP A,
CUSTOMERS B
WHERE A.CUST_ID = B.CUST_ID
AND B.RATING = 'A';
Rows Row Source Operation
------- ------------------------------------
0 STATEMENT
28 HASH JOIN
28 PARTITION LIST SINGLE PARTITION: 1
28 TABLE ACCESS FULL CUSTOMERS PARTITION: 1
56 TABLE ACCESS FULL SALE_TMP
-- Reference Partition
SELECT *
FROM SALES A,
CUSTOMERS B
WHERE A.CUST_ID = B.CUST_ID
AND B.RATING = 'A';
Rows Row Source Operation
------- -------------------------------------
0 STATEMENT
28 PARTITION LIST SINGLE PARTITION: 1
28 HASH JOIN
28 TABLE ACCESS FULL CUSTOMERS PARTITION: 1
28 TABLE ACCESS FULL SALES PARTITION: 1
6) Interval Partition
- Range Partition์์ ํน์ ๋ฒ์๋ฅผ ์ง์ ํ๊ณ ๊ด๋ฆฌํ ๋๋ ๋ฏธ๋ฆฌ Range๋ฅผ ๋ง๋ค์ด์ฃผ์ด์ผ ํ๊ณ
์์ฑ ์ดํ ๋ถํ ๋๋ ๋ณํฉ์ ํ ๋๋ ์ถ๊ฐ์ ์ธ ์์
์ ํด์ฃผ์ด์ผ ํ๋ค.
- ํ์ง๋ง 'Interval Partition'์์๋ ๊ฐ ํํฐ์
์ ๋ฏธ๋ฆฌ ์ ์ํจ์ผ๋ก์จ ํํฐ์
์์ฑ์ ์ค๋ผํด์ด
์ง์
ํด์ฃผ๋ ๋ฐฉ์์ด๋ค.
- ์์ Sample
-- 1. Range Partition ์์ฑ
CREATE TABLE SALES6
(
SALES_ID NUMBER,
SALES_DT DATE
)
PARTITION BY RANGE(SALES_DT)
(
PARTITION P0701 VALUES LESS THAN (TO_DATE('20070201', 'YYYYMMDD')),
PARTITION P0701 VALUES LESS THAN (TO_DATE('20070301', 'YYYYMMDD'))
);
-- 2. Partition Key ๊ฐ์ ๋ฒ์์ ์๋ ๊ฐ์ผ๋ก Insert
INSERT INTO SALES6 VALUES(1, TO_DATE('20070401', 'YYYYMMDD'));
-- Error
ORA-14400: inserted partition key does not map to any PARTITION
-- 3. Interval Partition ์์ฑ
CREATE TABLE SALES6
(
SALES_ID NUMBER,
SALES_DT DATE
)
PARTITION BY RANGE(SALES_DT) INTERVAL (NUMTOYMINTERVAL(1, 'MONTH'))
(
PARTITION P0701 VALUES LESS THAN(TO_DATE('20080201', 'YYYYMMDD'))
);
-- 4. Partition Key ๊ฐ์ ๋ฒ์์ ์๋ ๊ฐ์ผ๋ก Insert
INSERT INTO SALES6 VALUES(1, TO_DATE('20070601', 'YYYYMMDD'));
-- No Error
1 row created.
- ํํฐ์
์ ํน์ ํ
์ด๋ธ ์คํ์ด์ค์ ์ ์ฅํ๊ณ ์ถ๋ค๋ฉด STORE IN ๊ตฌ๋ฌธ์ผ๋ก ๊ฐ๋ฅํ๋ค.
-> INTERVAL (NUMTOYMINTERVAL(1, 'MONTH')) STORE IN (TS1, TS2, TS3)
- ์ดํ๋ฆฌ์ผ์ด์
๊ฐ๋ฐ์๊ฐ ํน์ ํํฐ์
์ ์ ๊ทผํ๊ณ ์ถ๋ค๋ฉด ๋ค์์ ๊ตฌ๋ฌธ์ผ๋ก ๊ฐ๋ฅํ๋ค.
-> SELECT * FROM SALES6 PARTITION FOR(TO_DATE('20080501', 'YYYYMMDD'));
7) System Partition
- ํ
์ด๋ธ ์์ฑ์ ํํฐ์
๊ตฌ๊ฐ์ ๋ฏธ๋ฆฌ ์ค์ ํ๋ ๊ฒ์ด ์๋๋ผ ์์๋ก ๋๋ ํํฐ์
์ ๋ํด
์ฌ์ฉ์๊ฐ ์ํ๋ ํํฐ์
์ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๋ ๋ฐฉ์.
- ์ด ๋ฐฉ์์ ์ฌ์ฉ์๊ฐ 'System Partition'์ผ๋ก ๋์ด ์๋ ํ
์ด๋ธ์ ๋ฐ์ดํฐ๋ฅผ DML ํ๊ณ ์ ํ ๋
์ง์ ํํฐ์
์ ์ง์ ํ์ฌ ํด์ฃผ์ด์ผ ํ๋ค.
- ๋ก์ปฌ ์ธ๋ฑ์ค ์์ฑ ์, ์ธ๋ฑ์ค๋ ๋์ผํ ๋ฐฉ๋ฒ์ผ๋ก ํํฐ์
๋๋๋ค.
- ์์ Sample
CREATE TABLE SALES3
(
SALES_ID NUMBER,
PRODUCT_CODE NUMBER,
STATE_CODE NUMBER
)
PARTITION BY SYSTEM
(
PARTITION P1 TABLESPACE USERS,
PARTITION P2 TABLESPACE USERS
);
- Insert ํ ๋๋ ๋ฐ๋์ ํํฐ์
์ ์ง์ ํด ์ฃผ์ด์ผ ํ๋ค.
-- Insert ํ ๋ ํ
์ด๋ธ์ ํํฐ์
์ ์ง์ ํ์ง ์์ ๊ฒฝ์ฐ
INSERT INTO SALES3 VALUES(1,101,1);
-- Error
ERROR at line 1:
ORA-14701: partition-extended name or bind variable must be used for DMLs on
tables partitioned by the System method
-- Insert์ ํ ๋ ํ
์ด๋ธ์ ํํฐ์
์ ์ง์ ํ ๊ฒฝ์ฐ
insert into sales3 partition (p1) values (1,101,1);
-- No Error
1 row created.
- Delete, Update ํ ๋๋ ํ์๋ ์๋์ง๋ง ํํฐ์
์ ์ง์ ํ์ง ์์ ๊ฒฝ์ฐ ๋ชจ๋ ํํฐ์
์
์ฐพ์๋ค๋
์ผ ํ๋ฏ๋ก ์ด ๊ฒฝ์ฐ์๋ ๊ฐ๊ธ์ ํํฐ์
์ ์ง์ ํด ์ฃผ์ด์ผ ํ๋ค.
-> DELETE SALES3 PARTITION(P1) WHERE STATUS_CODE = 1;
8) Virtual Column Partition
- ํํฐ์
์ผ๋ก ๋๋๊ณ ์ ํ๋ ์ปฌ๋ผ์ด ํ
์ด๋ธ์์ ๊ฐ๊ณต๋์ด ์ป์ ์ ์๋ ์ปฌ๋ผ์ผ ๊ฒฝ์ฐ
11g ์ด์ ์์๋ ์๋ก์ด ์ปฌ๋ผ์ ์ถ๊ฐํ๊ณ ํธ๋ฆฌ๊ฑฐ๋ฅผ ์ด์ฉํ์ฌ ์ปฌ๋ผ ๊ฐ์ ์์ฑํ๋ ๋ฐฉ๋ฒ์
์ฌ์ฉํ์ฌ ๋ง์ ์ค๋ฒํค๋๋ฅผ ๊ฐ์ํ์์ผ๋, 11g์์๋ 'Virtual Column Partition'์
์ง์ํ์ฌ ์ค์ ๋ก ์ ์ฅ๋์ง ์๋ ์ปฌ๋ผ์ ๋ฐํ์์ ๊ณ์ฐํ์ฌ ์์ฑํ ์ ์๋ค. ๋ํ
๊ฐ์ ์ปฌ๋ผ์ ํํฐ์
์ ์ ์ฉํ๋ ๊ฒ๋ ๊ฐ๋ฅํ๋ค.
- ์์ Sample
-- Virtual Partition ์์ฑ
CREATE TABLE SALES
(
SALES_ID NUMBER,
CUST_ID NUMBER,
SALE_CATEGORY VARCHAR2(6)
GENERATED ALWAYS AS
(
CASE WHEN SALES_AMT <= 10000 THEN 'LOW'
WHEN SALES_AMT BETWEEN 10000 AND 100000 THEN CASE WHEN CUST_ID < 101 THEN 'LOW'
WHEN BETWEEN 101 AND 200 THEN 'MEDIUM'
ELSE 'LOW' END
WHEN SALES_AMT BETWEEN 100000 AND 1000000 THEN CASE WHEN CUST_ID < 101 THEN 'MEDIUM'
WHEN BETWEEN 101 AND 200 THEN 'HIGH'
ELSE 'ULTRA' END
ELSE 'ULTRA' END
) VIRTUAL
)
PARTITION BY LIST(SALES_CATEGORY)
(
PARTITION P_LOW VALUES ('LOW'),
PARTITION P_MEDIUM VALUES ('MEDIUM'),
PARTITION P_HIGH VALUES ('HIGH'),
PARTITION P_ULTRA VALUES ('ULTRA')
);
-- Insert ํ
์คํธ
INSERT INTO SALES(SALES_ID, CUST_ID, SALES_AMT) VALUES(1, 1, 100);
-- No Error
1 row created.
3. Partition Index
1) Local Index
- ์ธ๋ฑ์ค๋ฅผ ์์ฑํ ์ธ๋ฑ์ค์ ํํฐ์
๋ ์ธ๋ฑ์ค๊ฐ ๋์ผํ๊ฒ ํํฐ์
๋ ํํ๋ฅผ ๋งํ๋ค.
- ์ธ๋ฑ์ค์ ํ
์ด๋ธ์ ๊ฐ์ ์นผ๋ผ์ ์ํด ํํฐ์
๋๋ฉฐ, ํ๋์ ์ธ๋ฑ์ค ํํฐ์
์ด ํ
์ด๋ธ
ํํฐ์
ํ๋์ ๋์๋๋ฉฐ, ๋์๋๋ ์ธ๋ฑ์ค ํํฐ์
๊ณผ ํ
์ด๋ธ ํํฐ์
์ ๊ฐ๊ฐ ๊ฐ์ ๋ฒ์๋ฅผ ๊ฐ๊ฒ ๋๋ค.
- ๊ฒฐ๊ตญ ํน์ ํ ํ๋์ ์ธ๋ฑ์ค์ ํฌํจ๋ ๋ชจ๋ Key๋ค์ ํ๋์ ํ
์ด๋ธ ํํฐ์
๋ด์ ๋ฐ์ดํ๋ง์ ๊ฐ๋ฆฌํค๊ฒ ๋๋ค.
1-1) Local Prefixed Index
- ์ธ๋ฑ์ค์ ๋งจ ์์ ์๋ ์ปฌ๋ผ์ ์ํด ํํฐ์
๋๋ ๋ฐฉ์์ด๋ค.
- Local Prefixed Index์์ ์ปฌ๋ผ์ Unique/Non-Unique๋ฅผ ๋ชจ๋ ํ์ฉํ๋ค.
- Base Table์ ํํฐ์
์ด ๋ณ๊ฒฝ๋๋ฉด Local Index์ ๊ด๋ จ ํํฐ์
๋ง ๋ณ๊ฒฝ์ด ๋๋ค.
CREATE TABLE DEPT
(
DEPTNO NUMBER NOT NULL,
DNAME VARCHAR2(10) NOT NULL,
LOC VARCHAR2(14)
)
PARTITION BY RANGE (DEPTNO)
(PARTITION PART_1 VALUES LESS THAN (30),
PARTITION PART_2 VALUES LESS THAN (MAXVALUE)
);
CREATE INDEX DEPT_N1 ON DEPT(DEPTNO) LOCAL;
1-2) Local Non-Prefixed Index
- Index์ ์ฒซ๋ฒ์งธ column์ด Partition Key๊ฐ ์๋ ํํ๋ก Base Table๊ณผ ๋์ผํ Partition๊ตฌ์กฐ๋ฅผ ๊ฐ์ง Index์ด๋ค.
(equi-partitioned)
- ๋น ๋ฅธ access๊ฐ ์๊ตฌ๋ ๋ ์ ์ฉํ๋ค(Base Table์ Partition Key ๋ ์ ์ธ...)
- Partition๋จ์๋ก ๊ด๋ฆฌํ ์ ์์ผ๋ฏ๋ก Global Index์ ๋นํด ์ด์์ ํธ๋ฆฌํ๋ค.
- OLAP ์ธก๋ฉด์์ Global Index๋ณด๋ค ์กฐํ ์๋๊ฐ ์ ํ๋๋ค.
CREATE TABLE DEPT
(
DEPTNO NUMBER NOT NULL,
DNAME VARCHAR2(10) NOT NULL,
LOC VARCHAR2(14)
)
PARTITION BY RANGE (DEPTNO)
(PARTITION PART_1 VALUES LESS THAN (30),
PARTITION PART_2 VALUES LESS THAN (MAXVALUE)
);
CREATE INDEX DEPT_N2 ON DEPT(LOC) LOCAL;
2) Global Index
- Global Index๋ ํ
์ด๋ธ๊ณผ ๋ค๋ฅด๊ฒ ํํฐ์
๋๋ ๊ฒฝ์ฐ์ด๋ค.
2-1) Global Prefixed Index
- Base Table๊ณผ ๋น๊ตํ์ฌ not equi-partitioned ์ํ์ด๋ค.
- Oracle์ only Index structure๋ง ๊ด๋ฆฌํ๋ค (Partition์ ๊ด๋ฆฌ์ํจ)
- ์ต์ข
Partition์๋ Maxvalue๊ฐ์ด ๋ฐ๋์ ๊ธฐ์ ๋์ด์ผ ํ๋ค.
- Local index๋ณด๋ค ๊ด๋ฆฌํ๊ธฐ ํ๋ค๋ค.
- ๊ธฐ์ค Table์ Partition์ด ๋ณ๊ฒฝ๋๋ฉด global index์ ๋ชจ๋ Partition์ ์ํฅ์ ๋ฏธ์น๋ค
(Global Index ์ฌ์์ฑ ํด์ผ ํจ) -- ํ
์ด๋ธ ์์ฑ
CREATE TABLE SALES_DATA_2008
(
COLUMN_1 NUMBER NOT NULL,
COLUMN_2 VARCHAR2(4),
COLUMN_3 VARCHAR2(4),
COLUMN_4 VARCHAR2(2),
COLUMN_5 VARCHAR2(2),
COLUMN_6 NUMBER
)
PARTITION BY RANGE ( COLUMN_3, COLUMN_4 )
(
PARTITION P_200801 VALUES LESS THAN ( '04', '01' ),
PARTITION P_200802 VALUES LESS THAN ( '07', '01' ),
PARTITION P_200803 VALUES LESS THAN ( '10', '01' ),
PARTITION P_200804 VALUES LESS THAN ( '12', MAXVALUE )
);
-- Global Prefixed Index
CREATE UNIQUE INDEX RANGE2_GPX8 ON SALES_DATA_2008( COLUMN_2, COLUMN_1)
TABLESPACE TABLE_SPACE_DATA_1
PCTFREE 10
STORAGE(INITIAL 100K NEXT 100K PCTINCREASE 0 )
GLOBAL PARTITION BY RANGE ( CODE )
(
PARTITION P_2008_P1 VALUES LESS THAN ('2000'),
PARTITION P_2008_P2 VALUES LESS THAN ('3000'),
PARTITION P_2008_P3 VALUES LESS THAN (MAXVALUE)
);
2-2) Non-Partitioned Index
- ํํฐ์
๊ณผ๋ ์๋ฌด๋ฐ ์๊ด์๋ Normal Index๋ฅผ ๋งํจ.
III. ํํฐ์
์ ์ฌ์ฉํ ๋ ์์์ผ ํ ์ฌํญ๋ค
1. ํํฐ์
ํ
์ด๋ธ ๋ฐ ์ธ๋ฑ์ค ๊ด๋ฆฌ๋ฅผ ์ํ ๋ช
๋ น์ด๋ค
1) ์ผ๋ฐ ํ
์ด๋ธ ํํฐ์
ํ๊ธฐ
- Export/Import! ํ๋ ๋ฐฉ๋ฒ
-- ํ
์ด๋ธ์ Export ํ๋ค.
exp user/password tables=number file=exp.dmp
-- ๋ฐฑ์
๋ฐ์ ํ
์ด๋ธ์ ์ ๊ฑฐํ๋ค.
drop table numbers;
-- ํํฐ์
ํ
์ด๋ธ์ ์์ฑํ๋ค.
CREATE TABLE NUMBER(QTY NUMBER(3), NAME VARCHAR2(15))
PARTITION BY RANGE(QTY)
(PARTITION P1 VALUES LESS THAN (501),
PARTITION P2 VALUES LESS THAN (MAXVALUE));
-- ignore=y๋ฅผ ์ฌ์ฉํ์ฌ ๋ฐ์ดํฐ๋ฅผ Import!ํ๋ค.
imp user/password tables=number file=exp.dmp ignore=y
- Subquery๋ฅผ ์ด์ฉํ ๋ฐฉ๋ฒ
-- ํํฐ์
ํ
์ด๋ธ์ ์์ฑํ๋ค.
CREATE TABLE PARTBL(QTY NUMBER(3), NAME VARCHAR2(15))
PARTITION BY RANGE(QTY)
(PARTITION P1 VALUES LESS THAN(501),
PARTITION P2 VALUES LESS THAN(MAXVALUE));
-- Subquery๋ฅผ ์ด์ฉํ์ฌ ํํฐ์
ํ
์ด๋ธ์ ๋ฐ์ดํฐ๋ฅผ ์
๋ ฅํ๋ค.
INSERT INTO PARTBL(QTY, NAME) SELECT * FROM ORIGTBL;
-- Subquery๋ฅผ ์ด์ฉํ์ฌ ํํฐ์
ํ
์ด๋ธ์ ๋ฐ์ดํฐ๋ฅผ ์
๋ ฅํ๋ค.
- Partition Exchange ๋ช
๋ น์ด๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ
-- ALTER TABLE EXCHANGE PARTITION์ ํํฐ์
ํ
์ด๋ธ์ ์ผ๋ฐ ํ
์ด๋ธ๋ก, ๋๋ ํํฐ์
๋์ด
-- ์์ง ์์ ํ
์ด๋ธ์ ํํฐ์
ํ
์ด๋ธ๋ก ๋ณ๊ฒฝ์ํฌ ๋ ์ฌ์ฉํ๋ค.
-- ํํฐ์
ํ
์ด๋ธ ์์ฑ
CREATE TABLE P_EMP (SAL NUMBER(7,2))
PARTITION BY RANGE(SAL)
(PARTITION EMP_P1 VALUES LESS THAN (2000),
PARTITION EMP_P2 VALUES LESS THAN (4000));
-- ์ฒซ๋ฒ์งธ ํํฐ์
์ ๋ค์ด๊ฐ ๋ฐ์ดํฐ
CREATE TABLE DUMMY_Y
SELECT SAL
FROM EMP
WHERE SAL < 2000;
-- ๋๋ฒ์งธ ํํฐ์
์ ๋ค์ด๊ฐ ๋ฐ์ดํฐ
CREATE TABLE DUMMY_Z
SELECT SAL
FROM EMP
WHERE SAL BETWEEN 2000 AND 3999;
ALTER TABLE P_EMP EXCHANGE PARTITION EMP_P1
WITH TABLE DUMMY_Y;
ALTER TABLE P_EMP EXCHANGE PARTITION EMP_P2
WITH TABLE DUMMY_Z;
- ์ฌ๋ฌ ๊ฐ์ ํํฐ์
์ผ๋ก ๋ถ๋ฆฌ๋ ํ
์ด๋ธ ์ค ์ผ๋ถ์ ํํฐ์
๋ง ๊ฐ์ง ํ
์ด๋ธ ์์ฑํ๊ธฐ
-- ๋ฐ์ดํ๋ฅผ Exportํ ํ ํ์ํ ํํฐ์
์ผ๋ก ์ด๋ฃจ์ด์ง ํ
์ด๋ธ์ ์์ฑํ๋ค.
-- ๋ฐ์ดํฐ ์์ฑ
CREATE TABLE YEAR(COL1 DATE) PARTITION BY RANGE (COL1)
(PARTITION OCTOBER VALUES LESS THAN ('01-NOV-1999) TABLESPACE OCTOBER,
PARTITION NOVEMBER VALUES LESS THAN ('01-DEC-1999) TABLESPACE NOVEMBER,
PARTITION DECEMBER VALUES LESS THAN (MAXVALUE) TABLESPACE DECEMBER);
-- ๋ฐ์ดํ๋ฅผ Import!
IMP USERNAME/PASSWORD FILE=EXPDAT.DMP FROMUSER=<OWNER> TOUSER=<OWNER>
TABLES=(YEAR:OCTOBER, YEAR:NOVEMBER, YEAR:DECEMBER)
- ํํฐ์
์ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ
-- ํํฐ์
ํ
์ด๋ธ ์์ฑ
CREATE TABLE PART_TBL
(IN_DATE CHAR(8) PRIMARY KEY,
EMPNO NUMBER,
ENAME VARCHAR2(20),
JOB VARCHAR2(20))
PARTITION BY RANGE (IN_DATE)
(PARTITION PART_TBL_03 VALUE LESS THAN ('20000331') TABLESPACE PTS_03,
PARTITION PART_TBL_04 VALUE LESS THAN ('20000430') TABLESPACE PTS_04,
PARTITION PART_TBL_05 VALUE LESS THAN ('20000531') TABLESPACE PTS_05,
PARTITION PART_TBL_06 VALUE LESS THAN ('20000630') TABLESPACE PTS_06,
PARTITION PART_TBL_07 VALUE LESS THAN ('20000731') TABLESPACE PTS_07,
PARTITION PART_TBL_08 VALUE LESS THAN ('20000831') TABLESPACE PTS_08,
PARTITION PART_TBL_09 VALUE LESS THAN ('20000930') TABLESPACE PTS_09,
PARTITION PART_TBL_10 VALUE LESS THAN ('20001031') TABLESPACE PTS_10);
-- ํํฐ์
์ถ๊ฐ
ALTER TABLE PART_TBL ADD PARTITION PART_TBL_11 VALUES LESS THAN ('20001130') TABLESPACE PTS_11;
ALTER TABLE PART_TBL ADD PARTITION PART_TBL_12 VALUES LESS THAN ('20001231') TABLESPACE PTS_12;
- ํน์ ํํฐ์
์ ์ญ์ ํ๋ ๋ฐฉ๋ฒ
ํน์ ํํฐ์
์ญ์ ์ดํ ์ญ์ ํ ํํฐ์
์ ๊ฐ์ด ๋ค์ด์ฌ ๊ฒฝ์ฐ ๊ทธ ๋ค์ VALUES LESS THAN์ผ๋ก ํธ์
๋๋ค.
ALTER TABLE PART_TBL DROP PARTITION PART_TBL_08;
- ํํฐ์
์ ๋๋๋ ๋ฐฉ๋ฒ
๋ง์ฝ 3์๋ง ๋ค์ด๊ฐ์๋ ํํฐ์
์ด ์์ ๊ฒฝ์ฐ, ์ฌ๊ธฐ์ 1, 2์์ ์ถ๊ฐํ๋ ค๋ฉด ํํฐ์
์์ Add๊ฐ ์๋
Split์ ํด ์ฃผ์ด์ผ ํ๋ค.
-- 3์ ํํฐ์
์์ 2์๊ณผ 3์์ Splitํจ.
ALTER TABLE PART_TBL SPLIT PARTITION PART_TBL_03 AT ('20000229')
INTO (PARTITION PART_TBL_02 TABLESPACE PTS_02,
PARTITION PART_TBL_03_1 TABLESPACE PTS_03);
-- 2์ ํํฐ์
์์ 1์๊ณผ 2์์ Splitํจ.
ALTER TABLE PART_TBL SPLIT PARTITION PART_TBL_02 AT ('20000131')
INTO (PARTITION PART_TBL_01 TABLESPACE PTS_01,
PARTITION PART_TBL_02_1 TABLESPACE PTS_02);
- ํํฐ์
์ด๋ฆ์ ๋ณ๊ฒฝํ๋ ๋ฐฉ๋ฒ
ALTER TABLE PART_TBL RENAME PARTITION PART_TBL_02_1 TO PART_TBL_02;
- ํํฐ์
์ ํ
์ด๋ธ์คํ์ด์ค๋ฅผ ์ฎ๊ธฐ๋ ๋ฐฉ๋ฒ
ALTER TABLE PART_TBL MOVE PARTITION PART_TBL_10 TABLESPACE PTS_10_1 NOLOGGING;
- ํน์ ํํฐ์
์ ๋ฐ์ดํฐ๋ฅผ Truncate ํ๋ ๋ฐฉ๋ฒ
Partition์ Data๋ฅผ ๋ชจ๋ ์ญ์ ํ๋ ค๋ฉด Truncateํ๋ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ ์๊ฐ ์๋๋ฐ,
Truncate๋ Rollback์ด ๋ถ๊ฐ๋ฅํ๋ฉฐ ํน์ Partition ์ ์ฒด๋ฅผ ์ญ์ ํ๋ฏ๋ก ์ฃผ์ํ์ฌ ์ฌ์ฉํ์ฌ์ผ ํ๋ค.
ALTER TABLE PART_TBL TRUNCATE PARTITION PART_TBL_02;
- ํํฐ์
ํ
์ด๋ธ์ ๋ฌผ๋ฆฌ์ ์ธ ์์ฑ ๋ณ๊ฒฝํ๋ ๋ฐฉ๋ฒ
Partition Table์ ํน์ Partition์ ์์ฑ๋ง ๋ณ๊ฒฝํ ์ ์๊ณ ,
Table์ ์์ฑ์ ๋ณ๊ฒฝํ์ฌ ์ ์ฒด Partition์ ๋ํด ๋์ผํ ๋ณ๊ฒฝ์ ํ ์ ์๋ค.
-- part_tbl์ ๋ชจ๋ Partition์ Next ๊ฐ์ด ๋ณ๊ฒฝ
ALTER TABLE PART_TBL STORAGE (NEXT 10M);
part_tbl_05 Partition์ Maxextents ๊ฐ๋ง ๋ณ๊ฒฝ
ALTER TABLE PART_TBL MODIFY PARTITION PART_TBL_05 STORAGE (MAXEXTENTS 1000);
- ์ธ๋ฑ์ค ๊ด๋ฆฌ
ํํฐ์
ํ
์ด๋ธ ๊ด๋ จ ๋ณ๊ฒฝ์์
์ ํ ํ์๋ ํ
์ด๋ธ์ ๊ฑธ๋ ค์๋ Local, Glocal Index์ ๋ํด
๋ฐ๋์ Rebuild๋ฅผ ํด ์ฃผ์ด์ผ ํ๋ค. -- ํน์ ํํฐ์
์ ์ธ๋ฑ์ค Rebuild
ALTER INDEX IND_PART_TBL REBUILD PARTITION I_PART_TBL_02;
-- ๊ธ๋ก๋ฒ ์ธ๋ฑ์ค Rebuild
ALTER INDEX PART_TBL_PK REBUILD;
2. Backup & Recovery
1) Export
- Table-Level Export
๊ธฐ์กด์ Table Export์ฒ๋ผ Table ์ ์ฒด๋ฅผ Exportํ๋ ๊ฒฝ์ฐ์ด๋ค.
์ด๋ Emp Table(Partitioned ๋๋ Non-Partitioned) ์ ์ฒด๋ฅผ Exportํ๋ ๊ฒฝ์ฐ์ด๋ค.
$ exp scott/tiger tables=emp file=emp.dmp
- Partition-Level Export
์ด๋ Partition Table์ ์ผ๋ถ Partition๋ง์ Exportํ๋ ๊ฒ์ผ๋ก,
Full Mode์ Export์์๋ ์ฌ์ฉํ์ง ๋ชปํ๊ณ , Table๋จ์์ Export์์๋ง ๊ฐ๋ฅํ๋ค.
':' ์ ์ด์ฉํ์ฌ Partition ์ด๋ฆ์ ์ง์ ํ๋ฉฐ ์ด ๊ฒฝ์ฐ Emp Table์ px Partition๋ง์ Export
$ exp scott/tiger tables=emp:px file=emp_par.dmp
- ๋ค์๊ณผ ๊ฐ์ด ๋ ๊ฐ์ง ๊ฒฝ์ฐ๋ฅผ Level์ ํผ์ฉํ์ฌ ์ฌ์ฉํ๋ ๊ฒ๋ ๊ฐ๋ฅํ๋ค.
Sales Table์ ์ ๋ถ๋ฅผ, Emp Table์์๋ px Partition๋ง์ Export.
$ exp scott/tiger tables=(emp:px, sales) file=both.dmp
2) Import!
- Table-Level Import!
Partitioned ๋๋ Non-Partitioned Table ์ ์ฒด๋ฅผ Import!ํ๋ค.
๋ชจ๋ Import! Mode (full, user, table)์์ ์ฌ์ฉ๋๋ค.
emp table(Partitioned ๋๋ non-Partitioned) ์ ์ฒด๋ฅผ Import!
$ imp scott/tiger file=wookpark.dmp tables=emp
- Partition-Level Import!
Export Dump File์์ (full, user, table์ค ์ด๋ ํ Mode๋ฅผ ์ด์ฉํ์ฌ Exportํ๊ฑด๊ฐ์)
Partitioned Tabled์ ์ผ๋ถ Partition๋ง์ Import!ํ๋ค.
Table Import! Mode์์๋ง ์ฌ์ฉ๊ฐ๋ฅํ๋ค.
-- emp table์ px Partition๋ง์ Import!.
-- ':'์ ์ด์ฉํ์ฌ Partition์ ์ง์
$ imp scott/tiger file=wookpark.dmp tables=emp:px
ํ
์ด๋ธ ๋จ์์ Import!์ ์ฐ์ Table Creation ๋ฌธ์ฅ์ ์ํํ๊ณ Row Insert๋ฌธ์ ์ํํ๋ ๊ฒ๊ณผ
๋ง์ฐฌ๊ฐ์ง๋ก, Partition-level Import!๋ ์ฐ์ Partitioned Table์ ์์ฑ ๋ฌธ์ฅ์ ์ํํ๊ณ
Row Insert๋ฌธ์ ์ํํ๊ฒ ๋๋ค.
๋ฐ๋ผ์ ignore=y option๋ฑ์ ์ ์ ํ ์ฌ์ฉํ๋ฉด, Non-Partitioned Table๊ณผ Partitioned Table๊ฐ์ ๋ณ๊ฒฝ,
Partitioned Table์ ๊ตฌ์กฐ ๋ณ๊ฒฝ๋ฑ์ ์ํํ ์ ์๊ฒ ๋๋ค.
๋ค์์๋ ๊ทธ ์ค ๋ช ๊ฐ์ง ์์ด๋ค.
1. ํํฐ์
๋์ด ์์ง ์์ ํ
์ด๋ธ์ Exp, Imp๋ฅผ ์ด์ฉํ์ฌ ํํฐ์
ํ๋ ์
1) ํํฐ์
๋์ด ์์ง ์์ ํ
์ด๋ธ์ Exportํ๋ค.
$ exp scott/tiger file=wookpark.dmp tables=emp
2) ํด๋น Table์ Dropํ๋ค.
DROP TABLE EMP
3) ํํฐ์
ํ
์ด๋ธ์ ์์ฑํ๋ค.
CREATE TABLE EMP
(EMPNO NUMBER(4) NOT NULL,
....
)
PARTITION BY RANGE (EMPNO),
(PARTITION EMP1 VALUES LESS THAN (1000) TABLESPACE TS1,
PARTITION EMP1 VALUES LESS THAN (2000) TABLESPACE TS2,
PARTITION EMP1 VALUES LESS THAN (3000) TABLESPACE TS3);
4) Import!ํ๋ค.
$ imp scott/tiger file=wookpark.dmp tables=emp ignore=y
2. Partitioned Table์ Partition๋ค์ exp/imp๋ฅผ ์ด์ฉํ์ฌ Mergeํ๋ ์
1) Merge์ ๋์์ด ๋๋ Partition์ Exportํ๋ค.
$exp scott/tiger file=wookpark.dmp tables=emp:emp2
2) Merge์ ๋์์ด ๋๋ Partition์ 'alter table...'๋ฌธ์ฅ์ผ๋ก Dropํ๋ค.
ALTER TABLE EMP DROP PARTITION EMP2;
3) Import!ํ๋ค.
$imp scott/tiger file=wookpark.dmp tables=emp:emp3 ignore=y
์ดํ emp Table์ ํ์ธํ๋ฉด, emp2 Partition์ ์๋ Data๊ฐ emp3 Partition์ Merge๋์ด ์์์
ํ์ธํ ์ ์๋ค.
3. IU(Index Unusable) ๋ฐ์ ์ฃผ์
1) IU(Index Unusable)๋ ํํฐ์
์ด ๋ณ๊ฒฝ๋จ์ผ๋ก ์ธํด ํํฐ์
ํ
์ด๋ธ์ ์๋ ์ธ๋ฑ์ค์ ์ํฅ์ ์ฃผ์ด
SELECT๋ DML์ ์๋ํ ๋ ์ค๋ฅ๊ฐ ๋ฐ์๋๋ ๊ฒ์ ๋งํ๋ค.
2) IU(Index Unusable)๋ฅผ ๋ฐ์์ํค๋ Case
- Direct path Load์ ๊ฒฝ์ฐ
Direct path SQL*Loader ์ํ ํ ์ธ๋ฑ์ค๊ฐ ํ
์ด๋ธ์ ํด๋น ๋ฐ์ดํฐ๋ณด๋ค ์ด์ ๊ฒ์ด๋ฉด,
Unusable ์ํ๊ฐ ๋๋ค (Oracle7์์๋ ์ธ๋ฑ์ค๊ฐ Direct Load State๊ฐ ๋์๋ค๊ณ ํํํ๋ค).
์ธ๋ฑ์ค๊ฐ ํ
์ด๋ธ์ ๋ฐ์ดํฐ๋ณด๋ค ์ด์ ์ํ๋ผ๋ ๊ฒ์ ๋ฐ์ดํฐ๋ฅผ Loadํ ํ ์ธ๋ฑ์ค๋ฅผ ์์ฑํ๋ ์ค์
Space ๋ถ์กฑ ๋ฑ์ ์์ธ์ผ๋ก ์ค๋ฅ๊ฐ ๋ฐ์ํ์๊ฑฐ๋, SKIP_INDEX_MAINTENANCE Option์ ์ฌ์ฉํ ๊ฒฝ์ฐ์ด๋ค.
- ROWID๊ฐ ๋ณ๊ฒฝ๋๋ ๊ฒฝ์ฐ
ALTER TABLE MOVE PARTITION๊ณผ ๊ฐ์ด ROWID๋ฅผ ๋ณํ์ํค๋ ์์
์ ์ํฅ๋ฐ๋ Local Index์
์ ์ฒด Global Index๋ฅผ Unusable ์ํ๊ฐ ๋๊ฒ ํ๋ค.
- ROWID๋ฅผ ์ง์ฐ๋ ์์
ALTER TABLE TRUNCATE PARTITION์ด๋ DROP PARTITION๊ณผ ๊ฐ์ด ํ
์ด๋ธ์ Row๋ฅผ ์ง์ฐ๋ ๊ฒฝ์ฐ
์ํฅ๋ฐ๋ Local Index Partition๊ณผ ๋ชจ๋ Global Index Partition์ Unusable ์ํ๋ก ๋ง๋ ๋ค.
- ํ
์ด๋ธ Partition ์ ์๋ฅผ ๋ณ๊ฒฝํ๋ ๊ฒฝ์ฐ
ALTER TABLE SPLIT PARTITION์ Local Index์ Partition Definition์ ๋ณ๊ฒฝ์ํค์ง๋ง,
์๋์ผ๋ก ์ธ๋ฑ์ค๋ฅผ ์๋ก์ด Definition์ ๋ง๊ฒ Rebuildํ์ง ์๊ธฐ ๋๋ฌธ์ ์ํฅ๋ฐ๋
Local Index Partition์ Unusable ์ํ๋ก ๋ง๋ ๋ค.
๋ํ ์ด๊ฒ์ ROWID๋ฅผ ๋ณ๊ฒฝ์ํค๊ธฐ ๋๋ฌธ์ ๋ชจ๋ Global Index Partition์ Unusable ์ํ๋ก ๋ง๋ ๋ค.
- ์ธ๋ฑ์ค Partition ์ ์๋ฅผ ๋ณ๊ฒฝํ๋ ๊ฒฝ์ฐ
ALTER INDEX SPLIT PARTITION์ Index์ Definition์ ๋ณ๊ฒฝ์ํค์ง๋ง,
์ํฅ๋ฐ์ Partition์ Rebuild์ํค์ง ์๋๋ค.
์ด ์์
์ ์ํฅ๋ฐ๋ ์ธ๋ฑ์ค ํํฐ์
๋ถ๋ถ์ Unusable ์ํ๋ก ๋ง๋ ๋ค.
๊ทธ๋ฌ๋ Global Index์ ๊ฒฝ์ฐ๋ ๊ทธ๋๋ก Usable ์ํ๋ก ๋๋ค.
3) ๊ฒฐ๊ณผ์ ์ผ๋ก IU ์ํ๊ฐ ๋๋ฉด ๋ค์๊ณผ ๊ฐ์ด ์กฐ์นํด์ผ ํ๋ค.
- Partition Index : Rebuild
- Non-Partition Index : Drop and Recreate
IV. ์ผ๋ฐ ํ
์ด๋ธ๊ณผ ํํฐ์
ํ
์ด๋ธ ํ
์คํธ
0. ๊ธฐ์ด ๋ฐ์ดํฐ ๋ง๋ค๊ธฐ
1) ์ผ๋ฐ ํ
์ด๋ธ
โ ํ
์ด๋ธ
CREATE TABLE APPS.NORMAL_TEST_TAB
(
MON_P1 DATE,
GRP_P2 NUMBER,
CNT_N1 NUMBER
);
โก ์ํ ๋ฐ์ดํฐ ๋ฃ๊ธฐ
INSERT INTO APPS.NORMAL_TEST_TAB
SELECT ADD_MONTHS(TO_DATE('200001', 'YYYYMM'),
DECODE(MOD(LEVEL, 10000),
0,
TRUNC(LEVEL / 10000),
TRUNC(LEVEL / 10000) + 1) - 1) MON_P1,
DECODE(MOD(LEVEL, 100),
0,
TRUNC(LEVEL / 100),
TRUNC(LEVEL / 100) + 1) * 100 GRP_P2,
LEVEL CNT_N1
FROM DUAL
CONNECT BY LEVEL <= 1000000
;
COMMIT;
โข ํต๊ณ์ ๋ณด
BEGIN
DBMS_STATS.GATHER_TABLE_STATS('APPS',
'NORMAL_TEST_TAB',
CASCADE => TRUE);
END;
/
NORMAL_TEST_TAB
---------------
Rows=997,141 Blocks=3,032
Empty Blocks=0 Avg Space=0
Chain Count=0 Avg Row Length=16
Avg Space Freelist Blocks=0 Freelist Blocks=0
Sample Size=54,167 Last Analyze=2008/08/24
Partitioned=NO
Column Name Nullable Column Type Distinct Buckets
-------------------------------- -------- ------------- ---------- ----------
MON_P1 DATE 101 1
GRP_P2 NUMBER 9,999 1
CNT_N1 NUMBER 997,141 1
INDEX
-----------------------------------------------------------------------------
2) ํํฐ์
ํ
์ด๋ธ
โ ํ
์ด๋ธ
CREATE TABLE APPS.PARTITION_TEST_TAB
(
MON_P1 DATE,
GRP_P2 NUMBER,
CNT_N1 NUMBER
)
PARTITION BY RANGE ( MON_P1 )
SUBPARTITION BY HASH( GRP_P2 )
(
PARTITION P200001 VALUES LESS THAN(TO_DATE('200001', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200002 VALUES LESS THAN(TO_DATE('200002', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200003 VALUES LESS THAN(TO_DATE('200003', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200004 VALUES LESS THAN(TO_DATE('200004', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200005 VALUES LESS THAN(TO_DATE('200005', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200006 VALUES LESS THAN(TO_DATE('200006', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200007 VALUES LESS THAN(TO_DATE('200007', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200008 VALUES LESS THAN(TO_DATE('200008', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200009 VALUES LESS THAN(TO_DATE('200009', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200010 VALUES LESS THAN(TO_DATE('200010', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200011 VALUES LESS THAN(TO_DATE('200011', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200012 VALUES LESS THAN(TO_DATE('200012', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200101 VALUES LESS THAN(TO_DATE('200101', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200102 VALUES LESS THAN(TO_DATE('200102', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200103 VALUES LESS THAN(TO_DATE('200103', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200104 VALUES LESS THAN(TO_DATE('200104', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200105 VALUES LESS THAN(TO_DATE('200105', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200106 VALUES LESS THAN(TO_DATE('200106', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200107 VALUES LESS THAN(TO_DATE('200107', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200108 VALUES LESS THAN(TO_DATE('200108', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200109 VALUES LESS THAN(TO_DATE('200109', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200110 VALUES LESS THAN(TO_DATE('200110', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200111 VALUES LESS THAN(TO_DATE('200111', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200112 VALUES LESS THAN(TO_DATE('200112', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200201 VALUES LESS THAN(TO_DATE('200201', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200202 VALUES LESS THAN(TO_DATE('200202', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200203 VALUES LESS THAN(TO_DATE('200203', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200204 VALUES LESS THAN(TO_DATE('200204', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200205 VALUES LESS THAN(TO_DATE('200205', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200206 VALUES LESS THAN(TO_DATE('200206', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200207 VALUES LESS THAN(TO_DATE('200207', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200208 VALUES LESS THAN(TO_DATE('200208', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200209 VALUES LESS THAN(TO_DATE('200209', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200210 VALUES LESS THAN(TO_DATE('200210', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200211 VALUES LESS THAN(TO_DATE('200211', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200212 VALUES LESS THAN(TO_DATE('200212', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200301 VALUES LESS THAN(TO_DATE('200301', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200302 VALUES LESS THAN(TO_DATE('200302', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200303 VALUES LESS THAN(TO_DATE('200303', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200304 VALUES LESS THAN(TO_DATE('200304', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200305 VALUES LESS THAN(TO_DATE('200305', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200306 VALUES LESS THAN(TO_DATE('200306', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200307 VALUES LESS THAN(TO_DATE('200307', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200308 VALUES LESS THAN(TO_DATE('200308', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200309 VALUES LESS THAN(TO_DATE('200309', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200310 VALUES LESS THAN(TO_DATE('200310', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200311 VALUES LESS THAN(TO_DATE('200311', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200312 VALUES LESS THAN(TO_DATE('200312', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200401 VALUES LESS THAN(TO_DATE('200401', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200402 VALUES LESS THAN(TO_DATE('200402', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200403 VALUES LESS THAN(TO_DATE('200403', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200404 VALUES LESS THAN(TO_DATE('200404', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200405 VALUES LESS THAN(TO_DATE('200405', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200406 VALUES LESS THAN(TO_DATE('200406', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200407 VALUES LESS THAN(TO_DATE('200407', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200408 VALUES LESS THAN(TO_DATE('200408', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200409 VALUES LESS THAN(TO_DATE('200409', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200410 VALUES LESS THAN(TO_DATE('200410', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200411 VALUES LESS THAN(TO_DATE('200411', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200412 VALUES LESS THAN(TO_DATE('200412', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200501 VALUES LESS THAN(TO_DATE('200501', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200502 VALUES LESS THAN(TO_DATE('200502', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200503 VALUES LESS THAN(TO_DATE('200503', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200504 VALUES LESS THAN(TO_DATE('200504', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200505 VALUES LESS THAN(TO_DATE('200505', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200506 VALUES LESS THAN(TO_DATE('200506', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200507 VALUES LESS THAN(TO_DATE('200507', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200508 VALUES LESS THAN(TO_DATE('200508', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200509 VALUES LESS THAN(TO_DATE('200509', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200510 VALUES LESS THAN(TO_DATE('200510', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200511 VALUES LESS THAN(TO_DATE('200511', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200512 VALUES LESS THAN(TO_DATE('200512', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200601 VALUES LESS THAN(TO_DATE('200601', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200602 VALUES LESS THAN(TO_DATE('200602', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200603 VALUES LESS THAN(TO_DATE('200603', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200604 VALUES LESS THAN(TO_DATE('200604', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200605 VALUES LESS THAN(TO_DATE('200605', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200606 VALUES LESS THAN(TO_DATE('200606', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200607 VALUES LESS THAN(TO_DATE('200607', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200608 VALUES LESS THAN(TO_DATE('200608', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200609 VALUES LESS THAN(TO_DATE('200609', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200610 VALUES LESS THAN(TO_DATE('200610', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200611 VALUES LESS THAN(TO_DATE('200611', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200612 VALUES LESS THAN(TO_DATE('200612', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200701 VALUES LESS THAN(TO_DATE('200701', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200702 VALUES LESS THAN(TO_DATE('200702', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200703 VALUES LESS THAN(TO_DATE('200703', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200704 VALUES LESS THAN(TO_DATE('200704', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200705 VALUES LESS THAN(TO_DATE('200705', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200706 VALUES LESS THAN(TO_DATE('200706', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200707 VALUES LESS THAN(TO_DATE('200707', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200708 VALUES LESS THAN(TO_DATE('200708', 'YYYYMM')) SUBPARTITIONS 100,
PARTITION P200709 VALUES LESS THAN(TO_DATE('200709', 'YYYYMM')) SUBPARTITIONS 100,
-- 9400์์ 10,000๊ฐ ํํฐ์
์ ๊ทผ์ ํด์ ๋ ๋์ด๋๋ ๊ตฌ๊ฐ์ด๋ผ MAXVALUE ์ฒ๋ฆฌํจ
PARTITION P5 VALUES LESS THAN(MAXVALUE) SUBPARTITIONS 100
);
โก ์ํ ๋ฐ์ดํฐ ๋ฃ๊ธฐ
INSERT INTO APPS.PARTITION_TEST_TAB
SELECT ADD_MONTHS(TO_DATE('200001', 'YYYYMM'),
DECODE(MOD(LEVEL, 10000),
0,
TRUNC(LEVEL / 10000),
TRUNC(LEVEL / 10000) + 1) - 1) MON_P1,
DECODE(MOD(LEVEL, 100),
0,
TRUNC(LEVEL / 100),
TRUNC(LEVEL / 100) + 1) * 100 GRP_P2,
LEVEL CNT_N1
FROM DUAL
CONNECT BY LEVEL <= 1000000
;
COMMIT;
โข ํต๊ณ์ ๋ณด
BEGIN
DBMS_STATS.GATHER_TABLE_STATS('APPS',
'PARTITION_TEST_TAB',
CASCADE => TRUE);
END;
/
PARTITION_TEST_TAB
------------------
Rows=998,668 Blocks=74,646
Empty Blocks=0 Avg Space=0
Chain Count=0 Avg Row Length=16
Avg Space Freelist Blocks=0 Freelist Blocks=0
Sample Size=56,777 Last Analyze=2008/08/24
Partitioned=YES
Column Name Nullable Column Type Distinct Buckets
-------------------------------- -------- ------------- ---------- ----------
MON_P1 DATE 101 1
GRP_P2 NUMBER 9,994 1
CNT_N1 NUMBER 998,668 1
INDEX
-----------------------------------------------------------------------------
1. Full Table Scan
1) ํํฐ์
ํค๋ก Full Table Scan
โ ์ผ๋ฐ ํ
์ด๋ธ
SELECT *
FROM NORMAL_TEST_TAB
WHERE MON_P1 = :B1 -- 2007/01/01
AND GRP_P2 = :B2 -- 841000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 11 0.080 0.087 0 3064 0 100
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 13 0.080 0.088 0 3064 0 100
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
100 TABLE ACCESS FULL NORMAL_TEST_TAB (cr=3064 pr=0 pw=0 time=70247 us)
โก ํํฐ์
ํ
์ด๋ธ
SELECT *
FROM PARTITION_TEST_TAB
WHERE MON_P1 = :B1 -- 2007/01/01
AND GRP_P2 = :B2 -- 841000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 11 0.000 0.001 0 25 0 100
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 13 0.000 0.001 0 25 0 100
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
100 PARTITION RANGE SINGLE PARTITION: KEY KEY (cr=25 pr=0 pw=0 time=120 us)
100 PARTITION HASH SINGLE PARTITION: KEY KEY (cr=25 pr=0 pw=0 time=96 us)
100 TABLE ACCESS FULL PARTITION_TEST_TAB PARTITION: KEY KEY (cr=25 pr=0 pw=0 time=80 us)
2) ํํฐ์
ํค๊ฐ ์๋ ๊ฒ์ผ๋ก Full Table Scan
โ ์ผ๋ฐ ํ
์ด๋ธ
SELECT *
FROM NORMAL_TEST_TAB
WHERE CNT_N1 = :B1 -- 900000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 2 0.400 0.412 0 3055 0 1
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 4 0.400 0.412 0 3055 0 1
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
1 TABLE ACCESS FULL NORMAL_TEST_TAB (cr=3055 pr=0 pw=0 time=371933 us)
โก ํํฐ์
ํ
์ด๋ธ
-- 2๊ฐ ํํฐ์
ํค ๋ชจ๋ ์์ด
SELECT *
FROM PARTITION_TEST_TAB
WHERE CNT_N1 = :B1 -- 900000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 2 0.940 0.936 0 97104 0 1
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 4 0.940 0.937 0 97104 0 1
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
1 PARTITION RANGE ALL PARTITION: 1 94 (cr=97104 pr=0 pw=0 time=873415 us)
1 PARTITION HASH ALL PARTITION: 1 100 (cr=97104 pr=0 pw=0 time=933492 us)
1 TABLE ACCESS FULL PARTITION_TEST_TAB PARTITION: 1 9400 (cr=97104 pr=0 pw=0 time=924367 us)
-- 1๊ฐ ํํฐ์
ํค ์ ๋(1๋ธ๋ญ๋น 5๊ฐ ๋ก์ฐ ์ก์ธ์ค - ๊ทธ๋๋ง ํจ์จ)
SELECT *
FROM PARTITION_TEST_TAB
WHERE MON_P1 = :B1 -- 2007/01/01
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 1001 0.000 0.046 0 1948 0 10000
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 1003 0.000 0.046 0 1948 0 10000
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
10000 PARTITION RANGE SINGLE PARTITION: KEY KEY (cr=1948 pr=0 pw=0 time=40165 us)
10000 PARTITION HASH ALL PARTITION: 1 100 (cr=1948 pr=0 pw=0 time=40148 us)
10000 TABLE ACCESS FULL PARTITION_TEST_TAB PARTITION: KEY KEY (cr=1948 pr=0 pw=0 time=3704 us)
-- 1๊ฐ ํํฐ์
ํค ํ๋ฐ(100๋ธ๋ญ๋น 8๊ฐ ๋ก์ฐ ์ก์ธ์ค - ๋นํจ์จ์ )
SELECT *
FROM PARTITION_TEST_TAB
WHERE GRP_P2 = :B2 -- 841000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 11 0.010 0.013 0 1240 0 100
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 13 0.010 0.013 0 1240 0 100
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
100 PARTITION RANGE ALL PARTITION: 1 94 (cr=1240 pr=0 pw=0 time=10802 us)
100 PARTITION HASH SINGLE PARTITION: KEY KEY (cr=1240 pr=0 pw=0 time=12343 us)
100 TABLE ACCESS FULL PARTITION_TEST_TAB PARTITION: (cr=1240 pr=0 pw=0 time=11913 us)
-- ํํฐ์
ํค์์ ์ ๋ ์์ด ํ๋ฐ๋ง ๋ค์ด์ค๊ฒ ๋๋ฉด ๋นํจ์จ์
2. Index Ragne Scan
1) ์ธ๋ฑ์ค ์์ฑ
โ ์ผ๋ฐ ํ
์ด๋ธ
CREATE INDEX APPS.NORMAL_TEST_TAB_N1 ON APPS.NORMAL_TEST_TAB (MON_P1)
TABLESPACE APPS_TS_TX_IDX COMPUTE STATISTICS PARALLEL 6;
CREATE INDEX APPS.NORMAL_TEST_TAB_N2 ON APPS.NORMAL_TEST_TAB (MON_P1, GRP_P2)
TABLESPACE APPS_TS_TX_IDX COMPUTE STATISTICS PARALLEL 6;
CREATE INDEX APPS.NORMAL_TEST_TAB_N3 ON APPS.NORMAL_TEST_TAB (CNT_N1)
TABLESPACE APPS_TS_TX_IDX COMPUTE STATISTICS PARALLEL 6;
ALTER INDEX APPS.NORMAL_TEST_TAB_N1 NOPARALLEL;
ALTER INDEX APPS.NORMAL_TEST_TAB_N2 NOPARALLEL;
ALTER INDEX APPS.NORMAL_TEST_TAB_N3 NOPARALLEL;
โก ํํฐ์
ํ
์ด๋ธ
-- Local Prefixed Index
CREATE INDEX APPS.PARTITION_TEST_TAB_N1 ON APPS.PARTITION_TEST_TAB (MON_P1)
TABLESPACE APPS_TS_TX_IDX COMPUTE STATISTICS PARALLEL 6 LOCAL;
CREATE INDEX APPS.PARTITION_TEST_TAB_N2 ON APPS.PARTITION_TEST_TAB (MON_P1, GRP_P2)
TABLESPACE APPS_TS_TX_IDX COMPUTE STATISTICS PARALLEL 6 LOCAL;
-- Global Prefixed Index
CREATE INDEX APPS.PARTITION_TEST_TAB_N3 ON APPS.PARTITION_TEST_TAB (CNT_N1)
GLOBAL PARTITION BY RANGE(CNT_N1) (PARTITION P1 VALUES LESS THAN (100000),
PARTITION P2 VALUES LESS THAN (200000),
PARTITION P3 VALUES LESS THAN (300000),
PARTITION P4 VALUES LESS THAN (400000),
PARTITION P5 VALUES LESS THAN (500000),
PARTITION P6 VALUES LESS THAN (600000),
PARTITION P7 VALUES LESS THAN (700000),
PARTITION P8 VALUES LESS THAN (800000),
PARTITION P9 VALUES LESS THAN (900000),
PARTITION P10 VALUES LESS THAN (1000000),
PARTITION P11 VALUES LESS THAN (MAXVALUE))
TABLESPACE APPS_TS_TX_IDX COMPUTE STATISTICS PARALLEL 6;
ALTER INDEX APPS.PARTITION_TEST_TAB_N1 NOPARALLEL;
ALTER INDEX APPS.PARTITION_TEST_TAB_N2 NOPARALLEL;
ALTER INDEX APPS.PARTITION_TEST_TAB_N3 NOPARALLEL;
3) ํต๊ณ์ ๋ณด
โ ์ผ๋ฐ ํ
์ด๋ธ
NORMAL_TEST_TAB
---------------
Rows=997,141 Blocks=3,032
Empty Blocks=0 Avg Space=0
Chain Count=0 Avg Row Length=16
Avg Space Freelist Blocks=0 Freelist Blocks=0
Sample Size=54,167 Last Analyze=2008/08/24
Partitioned=NO
Column Name Nullable Column Type Distinct Buckets
-------------------------------- -------- ------------- ---------- ----------
MON_P1 DATE 101 1
GRP_P2 NUMBER 9,999 1
CNT_N1 NUMBER 997,141 1
INDEX
-----------------------------------------------------------------------------
NORMAL_TEST_TAB_N1 : MON_P1
Type=NORMAL, Uniq=No, Distinct=100, Rows=1,000,000, Last Analyze=2008/08/24
NORMAL_TEST_TAB_N2 : MON_P1 + GRP_P2
Type=NORMAL, Uniq=No, Distinct=10,000, Rows=1,000,000, Last Analyze=2008/08/24
NORMAL_TEST_TAB_N3 : CNT_N1
Type=NORMAL, Uniq=No, Distinct=1,000,000, Rows=1,000,000, Last Analyze=2008/08/24
โก ํํฐ์
ํ
์ด๋ธ
PARTITION_TEST_TAB
------------------
Rows=998,668 Blocks=74,646
Empty Blocks=0 Avg Space=0
Chain Count=0 Avg Row Length=16
Avg Space Freelist Blocks=0 Freelist Blocks=0
Sample Size=56,777 Last Analyze=2008/08/24
Partitioned=YES
Column Name Nullable Column Type Distinct Buckets
-------------------------------- -------- ------------- ---------- ----------
MON_P1 DATE 101 1
GRP_P2 NUMBER 9,994 1
CNT_N1 NUMBER 998,668 1
INDEX
-----------------------------------------------------------------------------
PARTITION_TEST_TAB_N1 : MON_P1
Partition=LOCAL NON_PREFIXED
Type=NORMAL, Uniq=No, Distinct=8, Rows=1,000,000, Last Analyze=2008/08/24
PARTITION_TEST_TAB_N2 : MON_P1 + GRP_P2
Partition=LOCAL PREFIXED
Type=NORMAL, Uniq=No, Distinct=10,000, Rows=1,000,000, Last Analyze=2008/08/24
PARTITION_TEST_TAB_N3 : CNT_N1
Partition=GLOBAL PREFIXED
Type=NORMAL, Uniq=No, Distinct=1,000,000, Rows=1,000,000, Last Analyze=2008/08/24
4) ํ
์คํธ
โ ์ผ๋ฐ ํ
์ด๋ธ
SELECT *
FROM NORMAL_TEST_TAB
WHERE MON_P1 = :B1 -- 2007/01/01
AND GRP_P2 = :B2 -- 841000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 11 0.000 0.000 0 24 0 100
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 13 0.000 0.001 0 24 0 100
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
100 TABLE ACCESS BY INDEX ROWID NORMAL_TEST_TAB (cr=24 pr=0 pw=0 time=36 us)
100 INDEX RANGE SCAN NORMAL_TEST_TAB_N2 (cr=13 pr=0 pw=0 time=621 us)(Object ID 2885525)
SELECT *
FROM NORMAL_TEST_TAB
WHERE CNT_N1 = :B1 -- 900000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 2 0.000 0.000 0 5 0 1
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 4 0.000 0.000 0 5 0 1
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
1 TABLE ACCESS BY INDEX ROWID NORMAL_TEST_TAB (cr=5 pr=0 pw=0 time=40 us)
1 INDEX RANGE SCAN NORMAL_TEST_TAB_N3 (cr=4 pr=0 pw=0 time=36 us)(Object ID 2885526)
โก ํํฐ์
ํ
์ด๋ธ
SELECT *
FROM PARTITION_TEST_TAB
WHERE MON_P1 = :B1 -- 2007/01/01
AND GRP_P2 = :B2 -- 841000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 11 0.000 0.001 0 23 0 100
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 13 0.000 0.001 0 23 0 100
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
100 PARTITION RANGE SINGLE PARTITION: KEY KEY (cr=23 pr=0 pw=0 time=71 us)
100 PARTITION HASH SINGLE PARTITION: KEY KEY (cr=23 pr=0 pw=0 time=55 us)
100 TABLE ACCESS BY LOCAL INDEX ROWID PARTITION_TEST_TAB PARTITION: KEY KEY (cr=23 pr=0 pw=0 time=46 us)
100 INDEX RANGE SCAN PARTITION_TEST_TAB_N2 PARTITION: KEY KEY (cr=12 pr=0 pw=0 time=826 us)(Object ID 2895022)
-- Global Prefixed Index
SELECT *
FROM PARTITION_TEST_TAB
WHERE CNT_N1 = :B1 -- 900000
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 2 0.000 0.000 0 4 0 1
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 4 0.000 0.000 0 4 0 1
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
1 PARTITION RANGE SINGLE PARTITION: KEY KEY (cr=4 pr=0 pw=0 time=49 us)
1 TABLE ACCESS BY GLOBAL INDEX ROWID PARTITION_TEST_TAB PARTITION: ROW LOCATION ROW LOCATION (cr=4 pr=0 pw=0 time=35 us)
1 INDEX RANGE SCAN PARTITION_TEST_TAB_N3 PARTITION: KEY KEY (cr=3 pr=0 pw=0 time=30 us)(Object ID 2904517)
;
-- Local Non-Prefixed Index
DROP INDEX APPS.PARTITION_TEST_TAB_N3;
CREATE INDEX
APPS.PARTITION_TEST_TAB_N3 ON APPS.PARTITION_TEST_TAB (CNT_N1)
TABLESPACE APPS_TS_TX_IDX COMPUTE STATISTICS PARALLEL 6 LOCAL;
-- FULL COLUMN
SELECT *
FROM PARTITION_TEST_TAB
WHERE MON_P1 = :B1 -- 2007/01/01
AND GRP_P2 = :B2 -- 841000
AND CNT_N1 = :B3 -- 840936
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.000 0 0 0 0
Fetch 2 0.000 0.000 0 4 0 1
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 4 0.000 0.000 0 4 0 1
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
1 PARTITION RANGE SINGLE PARTITION: KEY KEY (cr=4 pr=0 pw=0 time=99 us)
1 PARTITION HASH SINGLE PARTITION: KEY KEY (cr=4 pr=0 pw=0 time=73 us)
1 TABLE ACCESS BY LOCAL INDEX ROWID PARTITION_TEST_TAB PARTITION: KEY KEY (cr=4 pr=0 pw=0 time=55 us)
1 INDEX RANGE SCAN PARTITION_TEST_TAB_N3 PARTITION: KEY KEY (cr=3 pr=0 pw=0 time=41 us)(Object ID 2904529)
-- ํ๋ฐ ์์ด(์ ๋ํค๊ฐ ์์ผ๋ฉด PARALLEL ์ฒ๋ฆฌํ ๋ ๋ณด์ด๋ ์คํ๊ณํ ๋์ด)
SELECT *
FROM PARTITION_TEST_TAB
WHERE MON_P1 = :B1 -- 2007/01/01
AND CNT_N1 = :B3 -- 840936
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.018 0 200 0 0
Fetch 2 0.010 0.117 0 0 0 1
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 4 0.010 0.135 0 200 0 1
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
1 PX COORDINATOR (cr=200 pr=0 pw=0 time=37561 us)
0 PX SEND QC (RANDOM) :TQ10000 (cr=0 pr=0 pw=0 time=0 us)
0 PX PARTITION HASH ALL PARTITION: 1 100 (cr=0 pr=0 pw=0 time=0 us)
0 TABLE ACCESS BY LOCAL INDEX ROWID PARTITION_TEST_TAB PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us)
0 INDEX RANGE SCAN PARTITION_TEST_TAB_N3 PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us)(Object ID 2904529)
-- ์ ๋ ์์ด(์ ๋ํค๊ฐ ์์ผ๋ฉด PARALLEL ์ฒ๋ฆฌํ ๋ ๋ณด์ด๋ ์คํ๊ณํ ๋์ด)
SELECT *
FROM PARTITION_TEST_TAB
WHERE GRP_P2 = :B2 -- 841000
AND CNT_N1 = :B3 -- 840936
;
Call Count CPU Time Elapsed Time Disk Query Current Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse 1 0.000 0.000 0 0 0 0
Execute 1 0.000 0.009 0 188 0 0
Fetch 2 0.010 0.135 0 0 0 1
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total 4 0.010 0.144 0 188 0 1
Misses in library cache during parse: 0
Optimizer goal: ALL_ROWS
Parsing user: APPS (ID=44)
Rows Row Source Operation
------- ---------------------------------------------------
0 STATEMENT
1 PX COORDINATOR (cr=188 pr=0 pw=0 time=46595 us)
0 PX SEND QC (RANDOM) :TQ10000 (cr=0 pr=0 pw=0 time=0 us)
0 PX PARTITION HASH SINGLE PARTITION: KEY KEY (cr=0 pr=0 pw=0 time=0 us)
0 TABLE ACCESS BY LOCAL INDEX ROWID PARTITION_TEST_TAB PARTITION: (cr=0 pr=0 pw=0 time=0 us)
0 INDEX RANGE SCAN PARTITION_TEST_TAB_N3 PARTITION: (cr=0 pr=0 pw=0 time=0 us)(Object ID 2904529)