When you have three
or more tables that require outer joins, the order in which the
tables are joined is critical. Consider the example below:
In the sample Examine preview data below, the entries, 1, 2 ,3, and 4 listed under in TABLE4 are taken and outer-joined with the records in the two other tables. The three other tables contain fewer records. The relationships are defined, but now the order of execution is critical. Relationship A is executed first, followed by B, and then C.
Below is the query that is generated:
The nested join syntax that is generated forces the order of execution:
The join order key is relevant only in instances in which outer joins are deployed in business models. To make the importance of the execution order apparent, this information is displayed in the graphical view of the model.
In the sample Examine preview data below, the entries, 1, 2 ,3, and 4 listed under in TABLE4 are taken and outer-joined with the records in the two other tables. The three other tables contain fewer records. The relationships are defined, but now the order of execution is critical. Relationship A is executed first, followed by B, and then C.
Below is the query that is generated:
The nested join syntax that is generated forces the order of execution:
- Join TABLE1 and TABLE2 (shown in red)
- Join TABLE3 and A = B (shown in blue)
- Join TABLE4 with B = Result
The join order key is relevant only in instances in which outer joins are deployed in business models. To make the importance of the execution order apparent, this information is displayed in the graphical view of the model.
Note: It is not mandatory to use uppercase
letters, (A, B, C, as shown in the first image), to set the order in which tables
are executed. Any alphanumeric characters (0-9, A-Z) can be used. The system will
calculate the ASCII values of each character; the values are then used to determine
the order of execution. In the example, A, B, C, AA, AB, Pentaho Metadata Editor will execute
the table relationships in the following order: A, AA, AB, B, C.
To force conditions that would ordinarily be processed in the JOIN condition to be processed in the WHERE clause, follow the directions below to create a delay_outer_join_conditions custom property.
- Right-click on a business model and select Edit.
- Add a property by clicking the green + icon.
- Select Add a Custom Property and set its ID to delay_outer_join_conditions and select boolean for the Type, then click OK.
- Select the newly-created delay_outer_join_conditions property, then click the checkbox for delay_outer_join_conditions under the Custom heading on the right side of the window, then click OK.
Instead of the conditions being rolled into the
JOIN clause, they will be allowed to roll down into the
WHERE clause.