2 ms·
In front-end application's perspective, yes, it's a single request. And in the back-end, after the query was parsed it would be split to a bunch of requests de
by namelosw 7y ago
In front-end application's perspective, yes, it's a single request.
And in the back-end, after the query was parsed it would be split to a bunch of requests depends what's your data source.
If the data source is in-memory then good everything's done.
If the data source is an RDBMS it would result in an n+1 query. However, people would always use data loader with GraphQL, which batches the query and converts the n+1 query to two queries. REST APIs usually only care about single kind of resource per API, so if there are cascaded joins (eg: get the user and its posts and comments and comments' comments), there would be less overall requests in you are thinking in amortization.
If the data source is another REST API, if there's batch APIs for resources, the similar approach as RDBMS would also be taken.