Join Search Modes and Types
Two options are available for controlling the joined record selection process. They define:
| • | How to treat multiple versions of records with the same parent |
| • | What types of joined records should be returned |
The settings used depend on the question to be answered by the query.
Search Mode: Single Parent versus Multi-Parent
Consider a search for "John Smith" on the data presented in Persons Table, Addresses Table, and Phones Table. Looking at the denormalized data in Denormalized Table, you see that there are six possible combinations for the first parent record with the name "John Smith". If the goal is to find the correct "John Smith," there is no need to return all six combinations for the "John Smith" joined record. Only the best matching combination is needed. Returning additional combinations is harmful as it increases the chance that a valid match on a different parent record is lost because the returned set of records is filled with the unneeded combinations of the first parent record. When the objective is to find the best matching entity, it is best to use a single parent mode search. A single parent mode search returns only the single, best matching, joined record for a particular parent record.
Consider a different scenario, where you need to find all addresses and phone numbers for a particular person. Here, returning the one best combination for each parent would be incorrect as you are specifically interested in all the possible combinations of child records. When the focus is on the data in the child records, it is best to use a multi-parent mode search. A multi-parent mode search returns all combinations of child records for any parent record where the entire combination scores high enough to be included in the returned set of records.
The choice of a single parent or a multi-parent mode is based on the needs of the applications, but as a general rule:
| • | Use a single parent mode search where the desired data is in the parent record, |
| • | Use a multi-parent mode search where the desired data is in the child records. |
Consider the Java API example mentioned earlier:
NetricsJoin join_def = new NetricsJoin(“Persons”, |
The selection of single parent versus multi-parent mode is controlled by the third argument. This is a Boolean flag. If set to true, the multi-parent mode is used. If set to false, the single parent mode is used.
Some important performance issues need to be considered when choosing the search mode. For more information, see Performance Considerations.
Search Type: Selecting Record Types
The three types of joined records are full records, partial records, and orphan records. The type of record to be returned depends on the context of the search and the application. With TIBCO Patterns you can choose whether to return partial records or orphan records or both. Full records are always returned.
The four record type selections are:
| • | Full Records Only This ignores partial and orphan records returning only fully populated joined records. |
| • | Full and Partial Records This returns full records and partial records but ignores all orphan records. |
| • | Full and Orphan Records This returns full records and orphan records but ignores partial records. |
| • | All Record Types This returns all joined records: full records, partial records, and orphan records. |
In the example mentioned earlier, Full and Partial Records for a join type is used.
NetricsJoin join_def = new NetricsJoin(“Persons”, |
This is based on the assumption that the address and phone number are supplemental information used to help identify the desired person, and it is not of primary importance. Assuming this, if a record matches well, despite missing some of the supplemental information, it should still be returned. So, partial records should be included in the return set. A Full and Partial Records join is the most suitable join type to use when:
| • | The primary focus of the query is on the information in the parent record. |
| • | The child records represent optional supplemental information that helps identify a particular parent record. |
Consider a scenario where the primary purpose of the search is to find the person living at “123 Main St” with phone number “609-833-1010” and it is assumed that the name is “John Smith”. The query is the same, but the intent is different. In this case, returning partial records is not the right approach as you could say nothing about whether the address and phone number are the desired ones.
| • | The Full Records Only join type is the most suitable when the child record represents critical information. |
Consider a scenario where the primary purpose of the search is to find who, if anyone, is living at “123 Main St” in Clarksburg. The focus is on the Addresses child record. The query is the same, but this case specifically requires orphan records. Records with no person associated with the address also need to be included. Partial records with no address information are useless in this case.
| • | The Full and Orphan Records join type is the most suitable when the primary intent is to determine information about a child record. |
Consider a scenario where you need to check whether John Smith lives at “123 Main St” and has phone number “609-883-1001”. If the address or number is unassigned, you have to check that too. You also have to know whether "John Smith" has no address at all.
| • | The All Records join type is the most suitable when the intent is to discover the relationship between the records. |