A lot of ORMs default eager loading to select-in loading with multiple queries because it performs best. First A is loaded and then the B query has a `WHERE B.foreign_key in (...all A id's loaded in the first step..)`.
Still has overhead, but usually less than duplicating data or using another serialization format like returning hierarchical json objects
Comments
Ideally a query could return multiple cte tables.
A lot of ORMs default eager loading to select-in loading with multiple queries because it performs best. First A is loaded and then the B query has a `WHERE B.foreign_key in (...all A id's loaded in the first step..)`.
Still has overhead, but usually less than duplicating data or using another serialization format like returning hierarchical json objects