Over-fetching and under-fetching

GraphQL Course · lesson 1 of 14 · 4 min read

The two REST problems GraphQL was built to solve - see them both in one query.

Open this lesson in the learning hub

Key points

  • Over-fetching: a REST endpoint returns everything about a customer when the screen shows a name.
  • Under-fetching: the same screen also needs orders, so you make a second and third round trip.
  • On mobile that is wasted bytes and wasted latency, and neither is fixable without a new endpoint.
  • GraphQL inverts it: the client states the shape it wants, in one request.
  • Delete a field from the query and it disappears from the response - try it below.

The response is the shape of the query - that single property is what GraphQL is for.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the GraphQL Course course, and every lesson in it is listed on the GraphQL Course contents page.