Bird
0
0

How can you optimize a GraphQL single endpoint to reduce over-fetching when clients request large nested data?

hard📝 Application Q9 of 15
GraphQL - Basics and Philosophy
How can you optimize a GraphQL single endpoint to reduce over-fetching when clients request large nested data?
AUse query variables and fragments to request only needed fields
BDisable nested queries entirely
CReturn all fields by default regardless of query
DSplit the single endpoint into multiple endpoints
Step-by-Step Solution
Solution:
  1. Step 1: Identify over-fetching problem

    Clients may request more data than needed causing performance issues.
  2. Step 2: Use query variables and fragments

    These allow clients to specify exactly which fields they want, reducing data size.
  3. Final Answer:

    Use query variables and fragments to request only needed fields -> Option A
  4. Quick Check:

    Variables and fragments reduce over-fetching [OK]
Quick Trick: Use variables and fragments to limit requested data [OK]
Common Mistakes:
  • Disabling nested queries reduces flexibility
  • Returning all fields wastes bandwidth
  • Splitting endpoint loses GraphQL benefits

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes