Interleaved tables
A table created with INTERLEAVE IN PARENT stores its rows under the root ancestor’s rows, so that a child row sorts directly after its parent.
Key rules
Section titled “Key rules”- The prefix uses the root ancestor’s table id:
0x01 ‖ root_table_id u32 BE. - After the parent’s key columns, at each level, the key inserts
0x00 ‖ child_table_id u32 BE. This marker is calledCHILD_MARK. - The depth is at most 8.
0x01 ‖ root_id ‖ parent pk ‖ 0x00 ‖ child_id ‖ child pk ‖ …The layout is computed by relations::layout_into (crates/strata-sql/src/relations.rs:271). The parent link is stored in the table definition, see Ext R: relations.
Why children follow their parent
Section titled “Why children follow their parent”The parent’s key is a prefix of the child’s key, and CHILD_MARK starts with 0x00, which is the lowest byte value. A child row therefore sorts after its parent row and before the next parent row.