The Joy and Agony of GraphQL
summary
Describes running GraphQL as a Rails server against Postgres, shows N+1 queries appearing across nested fields and how lazy resolvers with fibers and Shopify’s graphql-batch lead to promise-y code and odd stack traces, then highlights GraphQL Ruby’s new data_load_record and data_load_association methods (added week-before) that batch loads cleanly. Presents an alternate solution that annotates types to let Rails preload associations instead of fibers, and a working Postgres trick using a Postgres LATERAL join to page 10 comments per pull request.
AI-written summary · about
