Join Conditions and Partitioned Primary Indexes - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™
Follow these guidelines whenever possible when you are formulating join conditions for your queries against PPI tables.
  • If possible, specify join conditions with an equality join on the primary index column set and partitioning column set.

    This type of join condition uses an efficient, rowkey-based merge join.

  • Consider adding the partitioning column for the PPI table to the other table in the join.
  • For the case where the primary index column set does not contain the complete partitioning column set, specifying an equality join on the primary index column set, but not on the partitioning column set. It is better for there to be fewer partitions after any row partition elimination, and the fewer partitions that remain, the better.
  • The Optimizer can specify a sliding window join when there is a small number of partitions; otherwise, the table might need to be spooled and sorted.
  • Use RANGE_N to define fewer partitions for the table.
  • Specify join conditions on the partitioning columns to influence the Optimizer to use row partition elimination to reduce the number of partitions involved in the join.
  • Note that the Optimizer does not know whether a partition is unpopulated or populated, so it assumes that all defined partitions are populated with rows.

    PARTITION statistics help the Optimizer to estimate the cost of join plans, but the join plan selected by the Optimizer cannot assume that partitions are unpopulated.