The requested query cost is the maximum possible cost of a query, calculated by multiplying the requested page sizes of nested fields.
For a simple query, the cost is equal to the first parameter of the top-level field. For nested queries, the cost is the sum of the top-level request plus the product of all preceding page sizes in the hierarchy.
# Example Nested Query
{
countries(page: { first: 10 }) {
edges {
node {
states(page: { first: 5 }) {
edges {
node {
cities(page: { first: 3 }) {
totalCount
}
}
}
}
cities(page: { first: 5 }) {
totalCount
}
}
}
}
}
Calculation:
10 (Countries)
- 50 (10 Countries * 5 States)
- 150 (10 Countries * 5 States * 3 Cities)
- 50 (10 Countries * 5 Cities)
= 260 Total Points