GraphQL Query Cost Estimator
Estimate how expensive a GraphQL operation is before it reaches your server. Find the deeply nested and multiplied list selections, with every list size assumption written down.
Accepts an operation of up to 200,000 characters, a schema of up to 1,000,000 characters and variables of up to 200,000 characters. It counts at most 10,000 fields and 64 nesting levels, list sizes from 1 to 10,000 and field costs from 0 to 1,000. The estimate runs in your browser in a background worker. Downloads are a JSON report and a CSV breakdown. One operation, or several with the operation name set. Fragments are expanded. Up to 200,000 characters. Review the settings before running.
Your result
How to use GraphQL Query Cost Estimator
- Paste the GraphQL operation in the main box.
- Paste the schema as SDL or introspection JSON.
- Adjust the default list size, slicing arguments and field costs if your server uses other values.
- Run the estimate and review the hotspots, then download the JSON or CSV breakdown.
Useful next steps
Accepts an operation of up to 200,000 characters, a schema of up to 1,000,000 characters and variables of up to 200,000 characters. It counts at most 10,000 fields and 64 nesting levels, list sizes from 1 to 10,000 and field costs from 0 to 1,000. The estimate runs in your browser in a background worker. Downloads are a JSON report and a CSV breakdown.
The cost model
Each selected field has the object or scalar cost for its return type, multiplied by the list sizes above it. The total is the sum over expanded field selections; repeated selections can therefore overestimate merged server execution. __typename is free. This planning model does not execute a server, conditional directives or nested list contents, and is not a server-enforced limit.
List sizes
A list field takes its size from the largest slicing argument, such as first, last or limit. Operation variable defaults and schema argument defaults are used when a value is omitted. Without a slicing value it uses @listSize(assumedSize:) when enabled, then the model default list size. @cost(weight:) replaces a field cost. All derived sizes must be whole numbers from 1 to 10,000, and weights from 0 to 1,000. Invalid operations, variables, bounds and cyclic fragments stop the estimate with a typed error.
Reading the report
The report lists assumptions, the ten most expensive subtrees and the full tree with depth, multiplier, list size, own cost and subtree cost. The CSV has one row per field path. Fragment spreads expand where used; a cyclic fragment is a query validation error rather than a finite cost assumption.