4.1 range-range
建表示例:
CREATE TABLE TEST_RANGE_RANGE
(vl1 date,
vl2 number(12)
)
PARTITION BY RANGE (vl1)
SUBPARTITION BY RANGE (vl2)
SUBPARTITION TEMPLATE
(
SUBPARTITION SP1_1 VALUES LESS THAN (100000),
SUBPARTITION SP2_2 VALUES LESS THAN (200000),
SUBPARTITION SP_3 VALUES LESS THAN (MAXVALUE)
)
(
PARTITION P1 VALUES LESS THAN (TO_DATE('2011-9-1', 'YYYY-MM-DD')),
PARTITION P2 VALUES LESS THAN (TO_DATE('2011-10-1', 'YYYY-MM-DD')),
PARTITION P3 VALUES LESS THAN (MAXVALUE)
);
4.2 range-hash
CREATE TABLE TEST_RANGE_HASH
(vl1 date,
vl2 number(12)
)
PARTITION BY RANGE (vl1)
SUBPARTITION BY HASH (vl2)
SUBPARTITION TEMPLATE
(
SUBPARTITION SP1,
SUBPARTITION SP2,
SUBPARTITION SP3)
(
PARTITION P1 VALUES LESS THAN (TO_DATE('2011-9-1', 'YYYY-MM-DD')),
PARTITION P2 VALUES LESS THAN (TO_DATE('2011-10-1', 'YYYY-MM-DD')),
PARTITION P3 VALUES LESS THAN (MAXVALUE)
);
4.3 range-list
CREATE TABLE TEST_RANGE_LIST
(vl1 date,
vl2 NUMBER
)
PARTITION BY RANGE (vl1)
SUBPARTITION BY LIST (vl2)
SUBPARTITION TEMPLATE
(
SUBPARTITION P1_1 VALUES (1,2,3,4,5),
SUBPARTITION P1_2 VALUES (6,7,8,9),
SUBPARTITION P1_3 VALUES (DEFAULT))
(
PARTITION P1 VALUES LESS THAN (TO_DATE('2011-9-1', 'YYYY-MM-DD')),
PARTITION P2 VALUES LESS THAN (TO_DATE('2011-10-1', 'YYYY-MM-DD')),
PARTITION P3 VALUES LESS THAN (MAXVALUE)
);
4.4 hash-range
建表示例:
CREATE TABLE TEST_HASH_RANGE
(vl1 date,
vl2 number(12))
PARTITION BY HASH (vl1)
SUBPARTITION BY RANGE (vl2)
SUBPARTITION TEMPLATE
(
SUBPARTITION P1_1 VALUES LESS THAN (100000),
SUBPARTITION P1_2 VALUES LESS THAN (200000),
SUBPARTITION P1_3 VALUES LESS THAN (MAXVALUE)
)
(PARTITION P1,
PARTITION P2,
PARTITION P3
);
4.5 hash-list
CREATE TABLE TEST_HASH_LIST
(vl1 date,
vl2 NUMBER)
PARTITION BY HASH (vl1)
SUBPARTITION BY LIST (vl2)
SUBPARTITION TEMPLATE
(
SUBPARTITION P1_1 VALUES (1,2,3,4,5),
SUBPARTITION P1_2 VALUES (6,7,8,9),
SUBPARTITION P1_3 VALUES (DEFAULT)
)
(PARTITION P1,
PARTITION P2,
PARTITION P3
);
4.6 hash-hash
CREATE TABLE TEST_HASH_HASH
(vl1 date,
vl2 NUMBER)
PARTITION BY HASH (vl1)
SUBPARTITION BY HASH (vl2)
SUBPARTITION TEMPLATE
(
SUBPARTITION SP1 ,
SUBPARTITION SP2 ,
SUBPARTITION SP3
)
(PARTITION P1,
PARTITION P2,
PARTITION P3
);
4.7 LIST-RANGE
建表示例:
CREATE TABLE TEST_LIST_RANGE
(vl1 varchar2(20),
vl2 number(12))
PARTITION BY LIST (vl1)
SUBPARTITION BY RANGE (vl2)
(
PARTITION P1 VALUES ('MIN', 'HOUR','SECOND')
(
SUBPARTITION P1_1 VALUES LESS THAN (100000),
SUBPARTITION P1_2 VALUES LESS THAN (200000),
SUBPARTITION P1_3 VALUES LESS THAN (MAXVALUE)
),
PARTITION P2 VALUES ('DAY', 'MONTH','YEAR')
(
SUBPARTITION P2_1 VALUES LESS THAN (100000),
SUBPARTITION P2_2 VALUES LESS THAN (200000),
SUBPARTITION P2_3 VALUES LESS THAN (MAXVALUE)
),
PARTITION P3 VALUES (DEFAULT)
(
SUBPARTITION P3_1 VALUES LESS THAN (100000),
SUBPARTITION P3_2 VALUES LESS THAN (200000),
SUBPARTITION P3_3 VALUES LESS THAN (MAXVALUE)
)
);
4.8 LIST-HASH
建表示例:
CREATE TABLE TEST_LIST_HASH
(vl1 varchar2(20),
vl2 number(12)
)
PARTITION BY LIST (vl1)
SUBPARTITION BY HASH (vl2)
SUBPARTITION TEMPLATE
(
SUBPARTITION SP1,
SUBPARTITION SP2,
SUBPARTITION SP3,
SUBPARTITION SP4
)
(
PARTITION P1 VALUES ('MIN', 'HOUR','SECOND'),
PARTITION P2 VALUES ('DAY', 'MONTH','YEAR'),
PARTITION P3 VALUES (DEFAULT)
);
4.9 LIST-LIST
建表示例:
CREATE TABLE TEST_LIST_LIST
(vl1 varchar2(20),
vl2 number(12)
)
PARTITION BY LIST (vl1)
SUBPARTITION BY LIST (vl2)
(
PARTITION P1 VALUES ('MIN', 'HOUR','SECOND')
(
SUBPARTITION P1_1 VALUES (1,2,3,4,5),
SUBPARTITION P1_2 VALUES (6,7,8,9),
SUBPARTITION P1_3 VALUES (DEFAULT)
),
PARTITION P2 VALUES ('DAY', 'MONTH','YEAR')
(
SUBPARTITION P2_1 VALUES (1,2,3,4,5),
SUBPARTITION P2_2 VALUES (6,7,8,9),
SUBPARTITION P2_3 VALUES (DEFAULT)
),
PARTITION P3 VALUES (DEFAULT)
(
SUBPARTITION P3_1 VALUES (1,2,3,4,5),
SUBPARTITION P3_2 VALUES (6,7,8,9),
SUBPARTITION P3_3 VALUES (DEFAULT)
)
);
|