Basing Partitioning on Modulo Partitioning of a Numeric Column - Teradata VantageCloud Lake

Lake - Database Reference

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
ohi1683672393549.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
ohi1683672393549

This form uses a single column with a range of values, and maximizes the number of partitions. As an example, assume that a telephone company has a table with detailed information about each outgoing telephone call. One the column is the originating phone number, defined with the DECIMAL data type. A possible partitioning expression can be defined as follows:

CREATE TABLE
…
PRIMARY INDEX (phone_number, call_start)
PARTITION BY phone_number mod 65535 + 1;

This partitioning expression, assuming millions of subscribers, populates each of the 65,535 partitions. Partitions may have different numbers of rows, because not all customers make the same number of phone calls, but the distribution among the partitions must be close to even. This partitioning expression can improve the performance of a query that examines all phone calls made from a number by orders of magnitude by scanning only one partition out of 65,535 instead of the entire table.

Disadvantages of this form are that the partitioning cannot be altered unless the table is empty, a maximum on 65535 partitions can be defined, and row partition elimination for queries is typically limited to constant or USING value equality conditions on the partitioning column.