Stage 3: Third single-level partitioning of the orders table - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Suppose you submit the following ALTER TABLE request on orders:

ALTER TABLE orders
  MODIFY PRIMARY INDEX
  ADD RANGE BETWEEN 5
            AND     9
            EACH    1;

This alters the partitioning expression to:

RANGE_N(o_custkey BETWEEN 5
                  AND     9
                  EACH    1, 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 5 
                  AND     9
                  EACH    1, 10 AND 100
                  EACH   10); /* p1 */
This changes the information implied by the second table definition about the partitioning of orders as follows:
  • Number of partitions in the first, and only, level = d1 = 15
  • Total number of combined partitions = d1 = 15
  • 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) = 6.
  • PARTITION#L2 through PARTITION#L15 are all 0.
  • Combined partition number = PARTITION = p1(15) = 6.

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

5 1
6 2
7 3
8 4
9 5
10 - 19 6
20 - 29 7
30 - 39 8
40 - 49 9
50 - 59 10
60 - 69 11
70 - 79 12
80 - 89 13
90 - 99 14
100 15

This table describes the PARTITION#L n values for a table having a 2-byte ROWID. With an 8-byte ROWID, the table has up to 62 partitions.