Hacker News new | ask | show | jobs
by Horusiath 3379 days ago
It depends on the actual implementation of the server side, that you're using. From what I remember (this may have changed):

- Ruby implementation can dig into Active Record to perform batching of the queries, that normally would be executed in parallel.

- JavaScript implementation may use DataLoader library to support the same batching behavior for basically any async (promise-based) operation. See this presentation, it shows how the issue look like and how Data Loader helps to solve it: https://www.youtube.com/watch?v=c35bj1AT3X8&t=15m42s

- Python and Elixir implementations can make use of information about query subsegments, so you can prefetch necessary data.

- F# implementation works in similar way to Elixir but it's not limited to analyse GraphQL query fragments, but can also perform live analysis of the user-defined resolve functions code to determine a tree of used F# objects and properties instead. This allow to diverge GraphQL domain model from the underlying database model.

- A lot of other libraries are dedicated to particular database or query language and map GraphQL schema directly onto database model, so GQL query is translated directly into underlying database query model (including joins).