Child Records

A child record is a standard record with the addition of a parent record key. A standard record has a single key value that forms the unique key for the record. A child record has two key values: the record key and the parent record key. The combination of the two forms the unique key value for a child record. As a child record has only one parent key value, it has at the most one parent record. In the case of the Joins Example, the “person_id” fields of the “Addresses” and “Phones” tables are the parent record key of a child record. In ibi Patterns - Search, the parent record key of the child record is the foreign key value for the record. It defines the link to the parent record.

Child records can only be added to a child table. The link between the child record and a parent record is established at the time a child record is added, or the associated parent is added or deleted. The link is fixed for the life of the child record and parent record. The parent key value in the child record is used to determine the parent record it is linked to. The parent record is always in the parent table of the child table the child record is added to. Similar to the link between child table and parent table, the link between child record and parent record is a link between physical records, not key values. The link exists until either the parent record or child record is deleted. Links survive updates of either record.

If a parent record with the parent key value does not exist at the time the child record is added, it becomes an orphan record.
If the parent record of a child record is deleted, the child record becomes an orphan record.
  • When a parent record is added, any child records with that parent key are linked.

Parent/Child links are established regardless of the order the records are added, but adding a parent record after its children carries a significant performance penalty. When adding large number of records, it is much faster to add the parent records first.

Orphan Records

An orphan record is any record in a child table that is not linked to a parent record. All standard records in a child table are always orphan records as they cannot be linked to a parent record. A child record can also be an orphan. This happens when the parent table contains no record with the parent key contained in the child record.

A child record that is an orphan is still a child record. You must provide both portions of the key, record-key, and parent-record-key, even though the record is not linked to a parent record.

Considerations

Because a child record has at the most one parent record, and a child record can appear only in a child table, all linkages in ibi Patterns - Search are one-to-many linkages. Many-to-many relationships between records are not supported.