How to do eager fetching of related data using F# SQLProvider with Postgres?

Viewed 62

I am using F# SQLProvider with F# GraphQL. To address classic N+1 select problem with GraphQL nested resolvers, I need to early fetch related/relational/nested data in top-level GraphQL resolver. The basic idea is to recursively walk the GraphQL request AST and build the SQL query with joins. It is very similar to the idea of almightly root resolver

So far, I can dynamically build the nested query but SQLProvider still loads the fresh data when nested field is accessed by the means of foreign key.

How can I address this problem with SQLProvider to avoid N+1 select?

0 Answers
Related