Rules for Using MERGE on Tables with Row-Partitioned Join Indexes
Following are the rules for using MERGE on tables with row-partitioned join indexes:
For example, you can specify a WHERE clause in the CREATE JOIN INDEX statement to create a sparse join index for which only those rows that meet the condition of the WHERE clause are inserted into the index, or, for the case of a row in the join index being updated in such a way that it no longer meets the conditions of the WHERE clause after the update, cause that row to be deleted from the index.
The process for this activity is as follows:
a Teradata Database checks the WHERE clause condition for its truth value after the update to the row.
IF the condition evaluates to … |
THEN the system … |
FALSE |
deletes the row from the sparse join index. |
TRUE |
retains the row in the sparse join index and proceeds to stage b. |
b Teradata Database evaluates the new result of the partitioning expression for the updated row.
IF the partitioning expression … |
THEN Teradata Database … |
evaluates to null and no appropriate NO RANGE and UNKNOWN option has been specified |
aborts the request, does not update either the base table or the sparse join index, and returns an error message to the requestor. |
evaluates to null and appropriate NO RANGE and UNKNOWN options have been specified |
handles the row by storing it in either the NO RANGE or UNKNOWN partition for the sparse join index, and continues processing requests. |
evaluates to a value |
stores the row in the appropriate partition, which might be different from the partition in which it was previously stored, and continues processing requests. |