diff --git a/docs/docs/guides/developer-guide/dataloaders/index.md b/docs/docs/guides/developer-guide/dataloaders/index.md index b35bca0e14..796aae1a7e 100644 --- a/docs/docs/guides/developer-guide/dataloaders/index.md +++ b/docs/docs/guides/developer-guide/dataloaders/index.md @@ -7,9 +7,11 @@ showtoc: true ## N+1 problem -Imagine a cart with 20 items. Your database pool is configured to 15: enough to handle most sccenario's. Your implementation requires you to perform an `async` calculation `isSubscription` for each cart item that require one or more queries to be executed each time it executes. It works fine for a cart with 10 items. But with more than 15 items, suddenly the cart takes 20 seconds to load. +Imagine a cart with 20 items. Your database pool is configured to 15: enough to handle most sccenario's. Your implementation requires you to perform an `async` calculation `isSubscription` for each cart item whih executes one or more queries each time it is called. It works fine for a cart with 10 items. But with more than 15 items, suddenly the cart takes 20 seconds to load. -The reason: the N+1 problem. Your cart is firing of 20 or more queries almost at the same time and is overwhelming your database pool. With 15 queries active in the pool, the next one has to wait until a slot becomes available in the pool, adding **significantly** to the query time. +The reason: the N+1 problem. Your cart is firing of 20 or more queries almost at the same time and is overwhelming your database pool. With 15 queries active in the pool, the next one has to wait until a slot becomes available in the pool, adding **significantly** to the GraphQL request. + +And even if you don't overwhelm your database pool, executing 10 queries to get 10 items is like going to the McDonald's drive-in to get 10 hamburgers and getting in line 10 times to get 1 hamburger at a time. It's not efficient. ## The solution: dataloaders