15.00 - Rules for Whether Join Indexes With Extra Tables Cover Queries - Teradata Database

Teradata Database SQL Data Definition Language Detailed Topics

Product
Teradata Database
Release Number
15.00
Content Type
Programming Reference
Publication ID
B035-1184-015K
Language
English (United States)

Rules for Whether Join Indexes With Extra Tables Cover Queries

The following rules explain how to design a set of underlying base tables for a join index definition in such a way to ensure that the Optimizer selects the index for an access plan if it inner joins more tables than the query references. Such join indexes are referred to as broad join indexes. See “Restriction on Coverage by Join Indexes When a Join Index Definition References More Tables Than a Query” on page 386, Database Design, and SQL Request and Transaction Processing for more information on broad join indexes.

 

IF there are more inner‑joined tables in a join index definition than the number of tables referenced in a query and …

THEN the Optimizer …

the extra joins are not made on foreign key-primary key columns in the underlying base tables

does not consider the join index for the query plan.

This is because the presence of extra joins in the definition can either eliminate existing rows from the query evaluation or produce duplicate rows during optimization.

the extra joins are made on foreign key-primary key columns in the underlying base tables

considers the join index for use in for the query plan.

both of the following conditions are true:

  • The join column set of the inner table in the extra outer join is unique
  • Either the inner table or both the inner and outer tables involved in the extra outer join are extra tables
  • See CREATE JOIN INDEX in SQL Data Definition Language for examples of properly defining join indexes to ensure that they can cover queries that specify fewer tables than are specified in the join index.