> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Complexity Limits

Plan: Developer Foundations

Lesson 12 of 28 · 15 min

### Complexity Limits

There is an algorithm that calculates the complexity of a GraphQL query. Requesting more objects such as fifty products versus five products and more sub-resources of a product (i.e. options, etc.), will drive up the complexity score of the query.

This is not something that is exposed to you as a consumer but it is something that BigCommerce is calculating. When a certain complexity is reached, the query will be rejected.

Queries that exceed the complexity score will receive an error response similar to the example below:

![Example response with complexity error](/_fern-img/255b3da62d0592a97dbb4285e009a68083c4906dc20908f5620b5b1d06c53dcf.webp)

The complexity limit error is usually caused by queries with a large quantity of deeply nested objects. For example, the query below requests four different product collections together with their prices, variants, options, and option values.

![Image](/_fern-files/bigcommerce.docs.buildwithfern.com/640271222e40a7344025252ec0c5609ec2e540a5fc880ace86c24fba4699e587/assets/learn/graphql-storefront-api/ComplexityLimits.gif)

You can easily reduce the complexity of this query by changing the number of products queried in each collection from `first:50` to `first:10`.

To reduce complexity, reduce the number of objects requested. For example, do the following:

* Limit collections to a smaller page size
* Reduce the number of items in nested collections
* Request fewer fields

> **Info**
>
> Image queries will return 10 by default.

## Resources

* [Complexity Limits](/developer/docs/storefront/guides/graphql-storefront-api#complexity-limits)