Can anyone explain how the new GraphQL cost computation algorithm works? Any formulas for nested fields would be appreciated.
Does this help you?
Hey @remy727, this blog post is from 2021. I believe that due to the migration from REST to GraphQL, they changed the logic. Now, retrieving 100 items doesn’t cost you 100 points.
the second link is from the current doc, you have all the details there:
Based on the documentation, can you explain why the queries below have the corresponding costs?
Cost: 12
query {
products(first:240) {
edges {
node {
title
}
}
}
}
Cost: 6
query {
products(first:12) {
edges {
node {
title
}
}
}
}
The cost should be different based on how many products are being returned.
That’s not relevant @remy727 I’m talking about the requested cost.
You can include the header Shopify-GraphQL-Cost-Debug=1
in your request to get a detailed breakdown of how each field contributes to the requested cost
Guys please don’t spam the topic if you don’t know the answer.