Tuesday, December 3, 2019

Ask HN: I don't get GraphQL. How do you solve the N+1 issue without preloading?

A neighborhood has many homes. Each home is owned by a person.

Say I have this graphql query:

    {
        neighborhoods {
            homes {
                owner {
                    name
                }
            }
        }
    }
I can preload the owners, and that'll make the data request be a single SQL query. Fine.

But what if I don't request the owner in the graphql query, the data will still be preloaded.

I'm not sure if this is a solved issue, or just a painpoint one must swallow when working with graphql.

Using Absinthe, DataLoader and Elixir by the way.


Comments URL: https://news.ycombinator.com/item?id=21698374

Points: 1

# Comments: 0



from Hacker News: Newest https://ift.tt/33RNfN6

0 comments:

Post a Comment