You
The orders GraphQL query takes almost 2s. Fix it.
Assistant
The slow GraphQL query is orders(first: 100) resolving customer per row, an N+1.
I added a DataLoader for customers. Query count per request dropped from 101 to 2 and p95 from 1.9s to 240ms.
- Added a test asserting at most 2 queries for a 100-row page.
- PR #5280 is open.
You
Are other resolvers doing the same thing?
Assistant
Other resolvers with the same shape:
Order.items(per-row product lookup)Invoice.customer
I would fix Order.items next; it is hit by the same page.
You
Go ahead and fix Order.items too.
Assistant
Done. Order.items now uses a product DataLoader. Queries per 100-row page: 3, down from 202.
You
Does the dataloader cache across requests?
Assistant
DataLoader batches per request only, so cache entries never outlive a request and customer edits show up immediately.