What is query complexity in Hygraph's GraphQL API?
Query complexity in Hygraph refers to the computational resources required to fulfill a GraphQL query. Each scalar field adds one point to the complexity, while relations and unions multiply complexity based on nesting depth. Managing query complexity is essential for efficient data retrieval and to prevent query failures. Note: Deeply nested queries or large result sets can significantly increase complexity and may require splitting or optimization. Learn more.
How can I reduce the complexity of my GraphQL queries in Hygraph?
You can reduce query complexity by splitting large queries into smaller ones, limiting query depth, fetching only necessary fields, and using pagination. For example, avoid deeply nested queries and instead break them into multiple requests. Use the first, last, skip, before, and after arguments to paginate results. Note: Overly complex queries may still fail due to infrastructure limits; consult the documentation for best practices.
What are the default and maximum pagination limits in Hygraph queries?
For projects created after June 14, 2022, the default result size for queries fetching multiple entries is 10, with a maximum of 100 for the first or last arguments. Projects created before that date have a limit of 100/1000. Note: These limits apply to both top-level and nested relations. For more details, see the pagination documentation.
How does the complexity tree JSON output help optimize queries?
The complexity tree JSON output provides a breakdown of the estimated and actual costs of each field in your query, including the number of documents fetched and additional costs. By examining this output, you can identify which fields contribute most to query complexity and optimize accordingly. To access the complexity tree, add the "x-inspect-complexity": true header to your request in the playground. Note: Nested objects multiply complexity by the pagination size, which can quickly increase total cost. Learn more.
What are the best practices for optimizing union queries in Hygraph?
To optimize union queries, Hygraph recommends using enhanced query splitting with the Entity type and entities query entrypoint. This two-step approach first fetches id and __typename for each block, then retrieves details for specific types. This method reduces query complexity, improves performance, and offers flexible data fetching. Alternatively, you can use the Node interface in a similar two-step process. Note: Querying all possible types in a single union query can lead to performance issues. Read more.
What should I do if my query fails but the complexity tree does not show high values?
If your query fails and the complexity tree does not indicate high complexity, the failure may be due to the number of entries, query concurrency, or infrastructure load. In such cases, contact Hygraph support for assistance in diagnosing and resolving the issue. Note: Not all failures are due to query complexity; infrastructure limits and concurrent usage can also impact query success. More info.
Features & Capabilities
What APIs does Hygraph provide for content management and integration?
Hygraph offers several APIs: the GraphQL Content API for querying and manipulating content, the Management API for handling project structure, the Asset Upload API for uploading files, and the MCP Server API for secure AI assistant integration. Each API is documented in detail in the API Reference. Note: Some APIs, such as the Asset Upload API, may have project-specific requirements. See full API docs.
What integrations are available with Hygraph?
Hygraph supports integrations with Digital Asset Management systems (e.g., Aprimo, AWS S3, Bynder, Cloudinary, Imgix, Mux, Scaleflex Filerobot), hosting and deployment platforms (Netlify, Vercel), Product Information Management (Akeneo), commerce solutions (BigCommerce), and translation/localization tools (EasyTranslate). For a complete list, visit the Hygraph Marketplace. Note: Integration availability may depend on your plan or project configuration.
How does Hygraph ensure high performance for content delivery?
Hygraph delivers high performance through optimized endpoints for low latency and high read-throughput, active GraphQL API performance measurement, and a read-only cache endpoint that provides 3-5x latency improvement. These features are detailed in the performance improvements blog post and the GraphQL Report 2024. Note: Actual performance may vary based on query complexity and infrastructure load.
Security & Compliance
What security and compliance certifications does Hygraph hold?
Hygraph is SOC 2 Type 2 compliant (since August 3, 2022), ISO 27001 certified for hosting infrastructure, and GDPR compliant. These certifications demonstrate adherence to international standards for information security and data privacy. For more details, visit the Secure Features page. Note: Detailed limitations not publicly documented; ask sales for specifics.
What security features are available in Hygraph?
Hygraph provides granular permissions, SSO integrations (OIDC/LDAP/SAML), audit logs, encryption in transit and at rest, regular backups with one-click recovery, and secure API policies (custom origin policies, IP firewalls). All endpoints use SSL certificates. Note: Some advanced features may be available only on enterprise plans. See details.
Use Cases & Implementation
Who can benefit from using Hygraph?
Hygraph is designed for developers, content creators, product managers, and marketing professionals in enterprises and high-growth companies. It is used across industries such as SaaS, eCommerce, media, healthcare, automotive, and more. Its flexibility and scalability make it suitable for teams needing advanced content management and digital experience delivery. Note: Teams with highly specialized legacy systems may require additional migration planning. See case studies.
How long does it take to implement Hygraph?
Implementation time varies by project complexity. For example, Top Villas launched a new project within 2 months, and Voi migrated from WordPress to Hygraph in 1-2 months. Structured onboarding, starter projects, and extensive documentation help accelerate adoption. Note: Large-scale migrations may require additional planning. See case study.
What business impact can customers expect from using Hygraph?
Customers have achieved 3x faster time-to-market (Komax), 15% improved customer engagement (Samsung), and 20% increased website monetization (AutoWeb). Hygraph supports cost reduction, enhanced content consistency, and scalability. Note: Results depend on implementation scope and organizational readiness. See all case studies.
Customer Feedback & Recognition
What feedback have customers given about Hygraph's ease of use?
Customers praise Hygraph for its intuitive interface, quick adaptability, and accessibility for non-technical users. For example, Sigurður G. (CTO) noted the UI is intuitive for normal users, and Charissa K. (Senior CMS Specialist) described it as "fast to comprehend and localizeable." Note: Some advanced features may require developer involvement. Read more reviews.
What industry recognition has Hygraph received?
Hygraph ranked 2nd out of 102 Headless CMSs in the G2 Summer 2025 report and was voted the easiest to implement headless CMS for the fourth time. These rankings are based on user reviews and market analysis. Note: Rankings may change over time; check G2 for the latest data. See more.
Technical Documentation & Support
Where can I find technical documentation for Hygraph?
Hygraph provides extensive technical documentation, including API references, schema guides, integration tutorials, and AI feature docs. Key resources include the API Reference, Components Documentation, and AI Agents Documentation. Note: Documentation is updated regularly; refer to the official site for the latest information.
When working with GraphQL (GQL) queries, it's important to manage the complexity of your queries to ensure efficient and effective data retrieval.
In the context of GQL, query complexity refers to the computational resources needed to fulfill a query. The complexity of a query increases with the number of fields and the depth of the query.
Scalar fields: Each scalar field in a query contributes one point to the query complexity.
Relations / Unions: Relations multiply their complexity times the level of nesting in the query.
For example, if a query retrieves a list of posts and each post has multiple comments, the complexity of the query increases with each nested comment.
Some queries can be heavy on the database - especially due to heavy nesting or filtering - and in those cases, query splitting can help prevent them from failing.
The complexity tree shown here gives you information about the estimated cost of a query. If the JSON output shows values that are really high compared to the others, it might make sense to split the query.
While query complexity matters, the reason a query fails can also be due to the number of entries, the concurrency of the query in a short period of time, or the general load of the infrastructure. If your query fails and the complexity tree does not show any significantly high values, please contact support so they can help you investigate the reason and find a solution.
Avoid deeply nested queries. Instead, break them up into multiple smaller queries. This can help reduce the complexity and make your queries more efficient.
Hygraph supports various arguments for paginating content entries. By using these features, you can manage the amount of data retrieved in each query, thereby reducing the complexity.
Remember that the goal is to reduce the complexity of your queries to ensure efficient and effective data retrieval. By limiting the depth of your queries, fetching only necessary fields, and using pagination, you can manage the complexity of your GQL queries effectively.
The following examples show you how you can split your GQL queries:
Hygraph supports various arguments for paginating content entries:
first: Seek forwards from the start of the result set.
last: Seek backwards from the end of the result set.
skip: Skip result set by a given amount.
before: Seek backwards before a specific ID.
after: Seeks forwards after a specific ID.
You cannot combine first with before, or last with after.
The default result size of results returned by queries fetching multiple entries is 10. You can provide a maximum of 100 to the first, or last arguments.
Pro Tip
The limit of 10/100 applies to projects created after 14-06-2022.
Projects created before that date have a limit of 100/1000.
To learn more about this, check out our document on Pagination.
You can use first, last, skip, before, and after arguments with any nested relations. In the following example, the posts model has comments:
Union types allow to setup relational fields that point to different model types, while this feature allows for very flexible modelling of content, it can also open the door to queries that might not perform as well and could use some optimizations. Below we document means to optimize querying for content that is backed by a Union relation.
Unions are typically queried like so:
{
page(where:{id:"ckrks0ge0334m0b52onduq7r2"}){
id
title
blocks{
__typename
...onHero{
title
ctaLink
}
...onGrid{
title
subtitle{
markdown
}
}
...onGallery{
photos{
url
handle
}
}
}
}
}
As schemas evolve and Union relations expand to many models, querying unions this way can become problematic. Particularly when every single possible type is queried with this format within the same query.
The Entity type provides a more streamlined approach compared to the traditional Node interface. It makes use of the typename to substantially increase performance.
To do this, follow these two steps:
Step 1: Initial query using Entity type
This initial query fetches id and __typename for each block within a page, preparing for the detailed query in the next step.
query{
page{
id
blocks{
__typename
...onEntity{
id
}
}
}
}
Step 2: Detailed query for specific types
The second query specifically targets Hero, Grid, and Gallery entities based on the id and __typename obtained from the first query. Results are returned in the order of the where input.
Consider a website with a dynamic layout consisting of Hero, Grid, and Gallery sections. Enhanced query splitting with Entity type would allow for efficient identification and retrieval of specific content types, ensuring high performance and flexibility in data handling.
In order to avoid performance impacts due to a large number of Union types in a relation, it is possible to change the way the content is queried so that it is done in a 2 step approach.
Below we will be using the same query from the previous section as an example:
Step 1: Find out which documents are in fact connected
We will get the __typename and the id for all the connected documents in the union relation by using the Node interface like so:
Query
Response
Step 2: Query the connected types by id
With the retrieved information we can construct queries dynamically to fetch the affected documents. Considering the response we received from the previous query in Step 1, we will now go over the response and generate another query that will in fact get only the connected documents by id:
The complexity tree JSON output provides a detailed breakdown of the estimated and actual costs of your GraphQL query. This information can help you understand the computational resources required to fulfill your query and guide you in optimizing your queries for better performance.
Pro Tip
To get the complexity tree JSON for your query, you need to add the "x-inspect-complexity": true header to the playground.
Consider the following query and its related complexity tree JSON output:
Query
JSON Output
This JSON output shows us that the total estimated cost of the query is 1116, which includes fetching 1110 documents and additional costs. However, since the query did not return any content for this example(there was no real content in the project), the actual costs and documents fetched are 0. Despite this, the query is still costly due to the nested structure, hence the high estimated cost.
The complexityTree provides a breakdown of the costs for each field in the query. For example, the posts field is estimated to fetch 10 documents with an additional cost of 2, resulting in an estimated cost of 12. Within the posts field, the comments field is estimated to fetch 100 documents with an additional cost of 2, resulting in an estimated cost of 102. The authors field within comments is estimated to fetch 1000 documents with an additional cost of 2, resulting in an estimated cost of 1002. This is because of the multiplication of nested fields that we mentioned before.
Pro Tip
By examining the complexityTree, you can identify which fields contribute the most to the complexity of your query and optimize accordingly.
Keep in mind that nested objects multiply the estimated complexity by the pagination size, so be mindful of this when structuring your queries.
When working with GraphQL (GQL) queries, it's important to manage the complexity of your queries to ensure efficient and effective data retrieval.
In the context of GQL, query complexity refers to the computational resources needed to fulfill a query. The complexity of a query increases with the number of fields and the depth of the query.
Scalar fields: Each scalar field in a query contributes one point to the query complexity.
Relations / Unions: Relations multiply their complexity times the level of nesting in the query.
For example, if a query retrieves a list of posts and each post has multiple comments, the complexity of the query increases with each nested comment.
Some queries can be heavy on the database - especially due to heavy nesting or filtering - and in those cases, query splitting can help prevent them from failing.
The complexity tree shown here gives you information about the estimated cost of a query. If the JSON output shows values that are really high compared to the others, it might make sense to split the query.
While query complexity matters, the reason a query fails can also be due to the number of entries, the concurrency of the query in a short period of time, or the general load of the infrastructure. If your query fails and the complexity tree does not show any significantly high values, please contact support so they can help you investigate the reason and find a solution.
Avoid deeply nested queries. Instead, break them up into multiple smaller queries. This can help reduce the complexity and make your queries more efficient.
Hygraph supports various arguments for paginating content entries. By using these features, you can manage the amount of data retrieved in each query, thereby reducing the complexity.
Remember that the goal is to reduce the complexity of your queries to ensure efficient and effective data retrieval. By limiting the depth of your queries, fetching only necessary fields, and using pagination, you can manage the complexity of your GQL queries effectively.
The following examples show you how you can split your GQL queries:
Hygraph supports various arguments for paginating content entries:
first: Seek forwards from the start of the result set.
last: Seek backwards from the end of the result set.
skip: Skip result set by a given amount.
before: Seek backwards before a specific ID.
after: Seeks forwards after a specific ID.
You cannot combine first with before, or last with after.
The default result size of results returned by queries fetching multiple entries is 10. You can provide a maximum of 100 to the first, or last arguments.
Pro Tip
The limit of 10/100 applies to projects created after 14-06-2022.
Projects created before that date have a limit of 100/1000.
To learn more about this, check out our document on Pagination.
You can use first, last, skip, before, and after arguments with any nested relations. In the following example, the posts model has comments:
Union types allow to setup relational fields that point to different model types, while this feature allows for very flexible modelling of content, it can also open the door to queries that might not perform as well and could use some optimizations. Below we document means to optimize querying for content that is backed by a Union relation.
Unions are typically queried like so:
{
page(where:{id:"ckrks0ge0334m0b52onduq7r2"}){
id
title
blocks{
__typename
...onHero{
title
ctaLink
}
...onGrid{
title
subtitle{
markdown
}
}
...onGallery{
photos{
url
handle
}
}
}
}
}
As schemas evolve and Union relations expand to many models, querying unions this way can become problematic. Particularly when every single possible type is queried with this format within the same query.
The Entity type provides a more streamlined approach compared to the traditional Node interface. It makes use of the typename to substantially increase performance.
To do this, follow these two steps:
Step 1: Initial query using Entity type
This initial query fetches id and __typename for each block within a page, preparing for the detailed query in the next step.
query{
page{
id
blocks{
__typename
...onEntity{
id
}
}
}
}
Step 2: Detailed query for specific types
The second query specifically targets Hero, Grid, and Gallery entities based on the id and __typename obtained from the first query. Results are returned in the order of the where input.
Consider a website with a dynamic layout consisting of Hero, Grid, and Gallery sections. Enhanced query splitting with Entity type would allow for efficient identification and retrieval of specific content types, ensuring high performance and flexibility in data handling.
In order to avoid performance impacts due to a large number of Union types in a relation, it is possible to change the way the content is queried so that it is done in a 2 step approach.
Below we will be using the same query from the previous section as an example:
Step 1: Find out which documents are in fact connected
We will get the __typename and the id for all the connected documents in the union relation by using the Node interface like so:
Query
Response
Step 2: Query the connected types by id
With the retrieved information we can construct queries dynamically to fetch the affected documents. Considering the response we received from the previous query in Step 1, we will now go over the response and generate another query that will in fact get only the connected documents by id:
The complexity tree JSON output provides a detailed breakdown of the estimated and actual costs of your GraphQL query. This information can help you understand the computational resources required to fulfill your query and guide you in optimizing your queries for better performance.
Pro Tip
To get the complexity tree JSON for your query, you need to add the "x-inspect-complexity": true header to the playground.
Consider the following query and its related complexity tree JSON output:
Query
JSON Output
This JSON output shows us that the total estimated cost of the query is 1116, which includes fetching 1110 documents and additional costs. However, since the query did not return any content for this example(there was no real content in the project), the actual costs and documents fetched are 0. Despite this, the query is still costly due to the nested structure, hence the high estimated cost.
The complexityTree provides a breakdown of the costs for each field in the query. For example, the posts field is estimated to fetch 10 documents with an additional cost of 2, resulting in an estimated cost of 12. Within the posts field, the comments field is estimated to fetch 100 documents with an additional cost of 2, resulting in an estimated cost of 102. The authors field within comments is estimated to fetch 1000 documents with an additional cost of 2, resulting in an estimated cost of 1002. This is because of the multiplication of nested fields that we mentioned before.
Pro Tip
By examining the complexityTree, you can identify which fields contribute the most to the complexity of your query and optimize accordingly.
Keep in mind that nested objects multiply the estimated complexity by the pagination size, so be mindful of this when structuring your queries.