Why it matters
A single GraphQL request can ask for a few fields or for millions of records: ten products, each with ten reviews, each by a customer with ten orders, is already a thousand rows. Servers protect themselves with depth limits and cost analysis, and clients hit those limits with errors that rarely say which part of the query is to blame.
This analyser validates the query against your schema with the core GraphQL rules (checked against graphql-core, the Python port of the reference implementation), then walks it field by field. Every field gets a weight and a multiplier from its page-size argument, so the table shows exactly where the cost comes from and how far a smaller first would bring it down.
How to use it
- Paste your schema in SDL.
- Paste the query, and any variables as JSON.
- Set the costs and limits your server uses.
- Read the validation errors, the totals and the cost of each field.
FAQ
How is GraphQL query cost calculated?
Each field has a weight, and fields that return lists multiply the cost of everything below them by the number of items requested. Summing over the query gives its cost.
What is query depth?
The deepest level of nested fields. Depth limits stop recursive queries such as friends of friends of friends.
What do @cost and @listSize do?
They come from the IBM GraphQL cost directive spec: @cost sets a field's weight, and @listSize says how many items a list returns or which arguments set its size.
Why is my list field assumed to return 10 items?
Without a page-size argument or @listSize, its size is unknown, so an assumption is used. Change it under Cost and limits, or annotate the schema.