Suppose you then submit the following ALTER TABLE request on orders:
ALTER TABLE orders MODIFY PRIMARY INDEX DROP RANGE BETWEEN 0 AND 9 EACH 10;
This alters the partitioning expression to:
RANGE_N(o_custkey BETWEEN 10 AND 100 EACH 10);
That is, the table definition after you have performed the ALTER TABLE request is as follows:
CREATE TABLE orders ( o_orderkey INTEGER NOT NULL, o_custkey INTEGER) PRIMARY INDEX (o_orderkey) PARTITION BY RANGE_N(o_custkey BETWEEN 10 AND 100 EACH 10); /* p1 */
This changes the information implied by the initial table definition about the partitioning of orders as follows:
- Number of partitions in the first, and only, level = d1 = 10
- Total number of combined partitions = d1 = 10
- Combined partitioning expression = p1
Now if o_custkey is 15, the following additional information is implied:
- Partition number for level 1 = PARTITION#L1 = p1(15) = 1.
- PARTITION#L2 through PARTITION#L15 are all 0.
- Combined partition number = PARTITION = p1(15) = 1.
The following table indicates the new partition numbers for the defined ranges for o_custkey:
| Value of o_custkey | Result of the new RANGE_N function Value of PARTITION Value of PARTITION#L1 |
|---|---|
| 10 - 19 | 1 |
| 20 - 29 | 2 |
| 30 - 39 | 3 |
| 40 - 49 | 4 |
| 50 - 59 | 5 |
| 60 - 69 | 6 |
| 70 - 79 | 7 |
| 80 - 89 | 8 |
| 90 - 99 | 9 |
| 100 | 10 |