4 ms·
I see GraphQL queries at work and some of them are almost 100 lines long because we're asking for/receiving almost all of the available data fields. So what wo
by ordinaryperson 8y ago
I see GraphQL queries at work and some of them are almost 100 lines long because we're asking for/receiving almost all of the available data fields.
So what would be a 1 line request in REST format is now 100x longer and complex and why? It's an internal service so we weren't worried about reducing bandwidth costs (the problem FB was presumably trying to solve). I assume it was adopted because it's sexy and/or the developer wanted an excuse to use it.
I also wonder about the performance benefits if your data is in a SQL db...if you're running a no-SQL db then you can specify only the fields you want but I'm guessing a SQL db is likely to lock and read the entire row/record, even if it's only returning a subset of values.
If you're building a big, public-facing API or if people will only want a small subset of available data fields exposed by the API, GraphQL makes sense, but I feel like devs are swapping out easier-to-implement and use REST APIs just because GraphQL sounds cool.
- arisb 8y agoIf you are only reading from a table I don't think any relational database implementing MVCC would lock anything.