|
|
|
|
|
by exogen
3159 days ago
|
|
> Okay but... I guess my question is: why are you denying a client the right to make a complex query? Is it because all your queries are kinda slow and so you must hand-optimize them, leading to a combinatoric explosion of codepaths? No, it's because: (1) This is a feature of literally every API, most of them just use the extremely blunt instrument of rate limiting (even if requesting the same simple scalar value field over and over again does not add any strain on the server, you'll be rate limited just the same). Why aren't you asking this same question about REST queries? and (2) The 'Graph' part of 'GraphQL' means that queries can theoretically request connected nested objects of nearly infinite depth. This doesn't require that anything about the query code be slow or needs to be hand-optimized, or that there be any complex codepaths, just that MORE JOINS == MORE WORK and MORE PAYLOAD, no matter how perfectly optimized it is. Why aren't you asking "why does REST deny clients the right to make as deeply nested queries as they need?" |
|
Combinatoric explosions of complexity via a single query path are not a feature of every API.
> The 'Graph' part of 'GraphQL' means that queries can theoretically request connected nested objects of nearly infinite depth.
Thanks for this.
> just that MORE JOINS == MORE WORK and MORE PAYLOAD
So like SQL but without all the excellent query complexity tools or clarity around what precipitates a join?
> Why aren't you asking "why does REST deny clients the right to make as deeply nested queries as they need?"
Because RESTful APIs tend not to allow ad hoc graph traversal. When they do, it's because they're tunneling a graph query language. When they do (e.g., ElasticSearch) I (and we, as in the community at large)_DO ask these questions.