An interesting concept, and I do agree that the post-join cost is something that we can probably safely ignore. But as I was reading it I was curious if a better way to start conceptually approaching the solution is to consider an n+1 table approach where any tables referenced will be returned (filtered to relevant rows and optionally omitting extraneous columns) along with an additional table containing necessary key references and any of the computed aggregates etc… this might shift the select phrase to instead of defining all desired columns to only specifying additionally needed columns.
But… I do have some objections to this concept it seems to place an extremely heavy value on the initial schema that SQL does not and causes difficulties in some scenarios when a single table is joined against multiple times for different purposes. I think it’d become difficult for the front end to decipher and rebuild the relationships without very heavy lifting.
It’s a really interesting idea and flips the established return structure on its head in a way I don’t hate.
Turun@feddit.de 10 months ago
Neat idea and solves e.g. the N+1 problem.
But doesn’t that just shift the DB logic (denormalization, filtering, aggregation) into the application code?
Nighed@sffa.community 10 months ago
So it returns only the data that would be returned from the query, so the filtering is done.
I can see some uses of it. If you look at what something like Entity Framework does behind the scenes to return nested objects, you can see how something like this might help.
Turun@feddit.de 10 months ago
Yeah, the post on Reddit had some insightful comments as well.
I did not think of nested objects that may be returned by an entity framework before.