3 ms·
> You can't just join in all the things, or select billions of rows by accident. How does GraphQL prevent you from selecting billions of things? I'm not too fa
by JMTQp8lwXL 7y ago
> You can't just join in all the things, or select billions of rows by accident.
How does GraphQL prevent you from selecting billions of things? I'm not too familiar, but if the answer is something like "you can limit to N results", SQL does have a LIMIT clause, so I'm unsure what is being meaningfully distinguished.
- frosted-flakes 7y agoA good implementation will calculate the estimated "cost" of a given query before executing it. This is quite tricky to do well, and I doubt many people do it. Once you know the cost of a given query, it's trivial to reject it if it's too expensive. A much better alternative is to only allow specific queries in production. These persisted queries can then be assigned an ID, and making a request is a matter of sending the ID with any variables.
- jp_sc 7y agoAgree. But isn't that the kind of API we wrote before GraphQL?
- dwwoelfel 7y agoIt's very different. The main difference is that you define the capabilities on the back end through your GraphQL schema once, then clients generate the query ids through an automated process in development. In the old way, someone would have to write backend code to build and maintain each individual endpoint. With GraphQL, you only maintain the schema on the backend.