Composite range-list partitioning is commonly used for large tables that store historical data and are commonly accessed on multiple dimensions. Often the historical view of the data is one access path, but certain business cases add another categorization to the access path. For example, regional account managers are very interested in how many new customers they signed up in their region in a specific time period. ILM and its tiered storage approach is a common reason to create range-list partitioned tables so that older data can be moved and compressed, but partition pruning on the list dimension is still available.
Example 3-9 creates a range-list partitioned
call_detail_records table. A telecommunication company can use this table to analyze specific types of calls over time. The table uses local indexes on
This example shows the use of interval partitioning. You can use interval partitioning in addition to range partitioning so that interval partitions are created automatically as data is inserted into the table.
Example 3-9 Creating a table with composite range-list partitioning
CREATE TABLE call_detail_records ( id NUMBER , from_number VARCHAR2(20) , to_number VARCHAR2(20) , date_of_call DATE , distance VARCHAR2(1) , call_duration_in_s NUMBER(4) ) PARTITION BY RANGE(date_of_call) INTERVAL (NUMTODSINTERVAL(1,'DAY')) SUBPARTITION BY LIST(distance) SUBPARTITION TEMPLATE ( SUBPARTITION local VALUES('L') TABLESPACE tbs1 , SUBPARTITION medium_long VALUES ('M') TABLESPACE tbs2 , SUBPARTITION long_distance VALUES ('D') TABLESPACE tbs3 , SUBPARTITION international VALUES ('I') TABLESPACE tbs4 ) (PARTITION p0 VALUES LESS THAN (TO_DATE('01-JAN-2005','dd-MON-yyyy'))) PARALLEL; CREATE INDEX from_number_ix ON call_detail_records(from_number) LOCAL PARALLEL NOLOGGING; CREATE INDEX to_number_ix ON call_detail_records(to_number) LOCAL PARALLEL NOLOGGING;