|
|
|
|
|
by ruslan_talpa
3274 days ago
|
|
You've hit a (pain) point.
While graphql reduces the amount of trips to the backend for the browser, those round trips get pushed down to a lower level, between backend and db.
The reference graphql-js implementation, while at first looks so easy, you just write a resolver for a field, makes it oh so easy to have terrible n+1 problems. dataloader helps a bit but it's not as optimal as it can be. You need to be very careful. To be optimal, you'll basically need to write very complex resolvers that inspect the AST themselves and fetch the data optimally which at that point is almost as writing your custom execution module. That is basically what i did, custom execution module to translate a graphql request to a single sql query (https://subzero.cloud/) |
|