When a SQL implementation is built on a KV storage engine, how do tables, rows, and columns typically map to the underlying KV data model?
When defining a hierarchy of tables, such as customers -> orders -> order_line_items, you can make the primary key of the child tables contain the primary key of the parent table.
e.g. (customer_id) for the customers table, (customer_id, order_id) for the orders table, then (customer_id, order_id, line_item_id) for the order_line_items.
When this is stored on disk in a sorted format, it makes joins between these extremely cheap because the data will all be next to each other on disk.
CockroachDB calls this "interleaved tables".
https://emsal.me/blog/5 this blog post has a good introduction to their implementation of interleaved tables.