GQL is an idea not an implementation. I don't believe there's anything preventing actual software from optimising this case. Or am I missing something here? The query defines what you're asking for so extra data does not necessarily need to be fetched.
In Elixir with Absinthe we can resolve to the specific fields we need and we don't load the entire records then slim down.
One annoying thing Absinthe did by default I noticed was fetching entire object from DB, even though the GraphQL query only returns it's ID. For example query below would fetch each person from a DB, even though we already had a list of person IDs on the friends level:
{
friends {
person {
id
}
}
}but I do think it's related to my nested object https://twitter.com/benawad/status/1212407236284338176
me { company { listings { projects { id name } } } }
This will initialize: a User, a Company, Listings and Projects of all listings.I can also write this in SQL using a couple of joins and return an array. The memory consumption is trivial in comparison to the original request.