CREATE TABLE my_table
(
a_time DATE,
a_location NUMBER,
customer_id NUMBER,
customer_name VARCHAR2(200)
)
PARTITION BY RANGE (a_time)
SUBPARTITION BY LIST (a_location)
(
PARTITION p_20130101 VALUES LESS THAN (TO_DATE('2013-01-01', 'YYYY-MM-DD'))
(
SUBPARTITION a_location_1_1 VALUES (1),
SUBPARTITION a_location_1_2 VALUES (2),
SUBPARTITION a_location_1_3 VALUES (3)
),
PARTITION p_20130201 VALUES LESS THAN (TO_DATE('2013-02-01', 'YYYY-MM-DD'))
(
SUBPARTITION a_location_2_1 VALUES (1),
SUBPARTITION a_location_2_2 VALUES (2),
SUBPARTITION a_location_2_3 VALUES (3)
),
PARTITION p_20130301 VALUES LESS THAN (TO_DATE('2013-03-01', 'YYYY-MM-DD'))
(
SUBPARTITION a_location_3_1 VALUES (1),
SUBPARTITION a_location_3_2 VALUES (2),
SUBPARTITION a_location_3_3 VALUES (3)
)
)
ENABLE ROW MOVEMENT;
Oracle 倒排索引用于数字 (my_table_idx) 表中的字符串和列。我会推荐常规索引。
CREATE INDEX my_table_idx ON my_table(customer_id);