How we use the Dataloader pattern for optimising GraphQL Joins at Hasura
The Hasura team uses a "dataloader" approach to optimize GraphQL joins. They analyze queries ahead of execution and modify each sub-query to extract required join keys. This process involves issuing individual calls to the remote schema, stitching results together, and tracking added columns for join keys. The complexity increases with nested joins and ambiguous paths in some cases. To handle these challenges, they refined their join tree definition by allowing branches to be annotated with a typename and retrieving the runtime type using a phantom field.
Company
Hasura
Date published
May 26, 2022
Author(s)
Antoine Leblanc
Word count
881
Hacker News points
None found.
Language
English