Bird
0
0

You want to optimize nested resolver execution to avoid multiple database calls for posts of many users. Which approach helps most?

hard📝 Application Q8 of 15
GraphQL - Type Relationships
You want to optimize nested resolver execution to avoid multiple database calls for posts of many users. Which approach helps most?
ABatch posts fetching using DataLoader or similar tool
BCall posts resolver separately for each user without caching
CRemove nested posts field from schema
DUse synchronous blocking calls in posts resolver
Step-by-Step Solution
Solution:
  1. Step 1: Identify problem with multiple calls

    Calling posts resolver for each user causes many database queries.
  2. Step 2: Use batching to reduce calls

    DataLoader batches requests to fetch posts for many users in one query.
  3. Final Answer:

    Batch posts fetching using DataLoader or similar tool -> Option A
  4. Quick Check:

    Batching reduces DB calls [OK]
Quick Trick: Batch nested data fetching to improve performance [OK]
Common Mistakes:
  • Calling resolver separately without batching
  • Removing needed schema fields
  • Using blocking calls causing slowdowns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GraphQL Quizzes