4 ms·
to solve N+1 in Ruby Graphql automatically I wrote a thingy that analyzes what fields were requested in a recursive manner and then uses a preloader at the root
by therusskiy 7y ago
to solve N+1 in Ruby Graphql automatically I wrote a thingy that analyzes what fields were requested in a recursive manner and then uses a preloader at the root level to load everything in advance. Solve 80% of N+1 problems automatically.
- cpursley 7y agoSound useful. Is this available as an open source lib?
- rectangletangle 7y agoI ended up doing something very similar for Django's ORM years ago, before GraphQL really came into popularity.
- rytill 7y agoDon't know why this isn't builtin to GQL libraries - seems like the whole point of GQL is to do these types of queries and it's horribly inefficient by default.