15.10 - Exclusion Join - Teradata Database

Teradata Database SQL Request and Transaction Processing

Teradata Database
Programming Reference
User Guide

Exclusion join is a product, merge, or hash join where only the rows that do not satisfy (are NOT IN) any condition specified in the request are joined.

In other words, exclusion join finds rows in the first table that do not have a matching row in the second table.

Exclusion join is an implicit form of the outer join. Geospatial column terms are not permitted for outer join conditions.

Exclusion product joins with dynamic row partition elimination are not supported for PPI tables that have 8‑byte partitioning.

Also see “Inclusion and Exclusion Product Joins With Dynamic Row Partition Elimination” on page 468.

The following SQL specifications frequently cause the Optimizer to select an exclusion join:

  • Use of the NOT IN logical operator in a subquery.
  • Use of the EXCEPT and MINUS set operators.
  • To avoid returning join rows that are null on the join column, use one of the following methods:

  • When you create a table, define any columns that might be used for NOT IN join conditions as NOT NULL.
  • When you write a query, qualify a potentially problematic join with an IS NOT NULL specification. For example,
  •    WHERE Customer.CustAddress IS NOT NULL
  • Exclusion merge join (see “Exclusion Merge Join” on page 463)
  • Exclusion product join (see “Exclusion Product Join” on page 465)
  • Exclusion hash join (see “Exclusion Hash Join” on page 446)