Hello
I am building an app with Dgraph as the backend & noticed that my GraphQL queries become very slow when I fetch deeply nested data. For eg; retrieving a user along with all their posts, comments & likes in one query looks elegant, but the response time increases a lot as the dataset grows. In some cases, the query even times out.
I have read that GraphQL is powerful for hierarchical data but I am unsure how to balance query depth with performance in Dgraph. Should I be breaking down large queries into smaller ones / is there a way to optimize schema design to handle these nested relationships more efficiently?
I am also not sure if caching can help in this case, since the data changes frequently.
Has anyone faced similar issues with nested queries in production? Checked GitHub - dgraph-io/dgraph-docs: A native GraphQL Database with a graph backend documentation guide for reference. Sometimes I feel that learning GraphQL concepts is similar to what is javascript , because both require understanding the fundamentals before building real applications.
I would appreciate advice on whether to restructure my schema, use query batching / apply specific Dgraph features to keep performance stable as data grows.
Thank you !!