@bahdcoder Thank you for the detailed info, your are correct in that we currently have optimizations to be made on the GraphQL plugin. This is a popular issue that we are discussing internally right now and will absolutely be a focus going forward.
Related tracking issue on GitHub
opened 08:13PM - 02 Nov 20 UTC
type: bug
type: enhancement
severity: medium
status: confirmed
source: core:database
source: plugin:graphql
## **Describe the bug**
This is a tracking issue for all the various issues r… elated to GraphQL performance as compared to REST or just in general poor relational performance
## **Context**
Currently GraphQL is performance very un-optimized on model entries that have quite a lot of relations or a very complex relational structure. This is not what we intended as GraphQL itself and the query system implemented should provide a much faster response as compared to something like REST, as the goal of GraphQL is to be faster however with a higher degree of control.
## **Current behavior**
(Taken from the OP of: https://github.com/strapi/strapi/issues/5182 but see linked issues for more current behavior)
> I've noticed some slow performance whenever the amount of relations started growing of an entry. I thought the fix mentioned in #4080 already fixed this, but after some testing, I've come up with the following results (same query/same output fields):
>
> REST: 110-120ms
> GraphQL: 900-910ms
>
> That's a big difference. After reading the original issue, I started to dig through the graphql plugin and started fiddling with the populate settings on line 155 in services/Loader.js (as already mentioned in the original post). Setting the populate to a hard coded [] results in a huge boost:
>
> GraphQL: 120-140ms
>
> The funny thing here is, the fields that originally are populated in the params, are still queryable after setting the populate to [].
> However, this does not seem to have effect when deep filtering. I not sure why, but i'll try to figure that out sometime this week.
## **Expected behavior**
GraphQL performance should be significantly faster than REST in many different use cases. Or at the very least, performance wise, in line with our REST implementation.
## **Related Issues, Feature requests, Discussions, and Forum threads**
Please note, the below are not the limit and additional entries may be linked to this issue, you can find them referenced in the comments.
- https://github.com/strapi/strapi/issues/5182
- https://github.com/strapi/strapi/issues/4080
- https://github.com/strapi/strapi/issues/8535
- https://github.com/strapi/strapi/issues/5363
- https://github.com/strapi/strapi/issues/3552
More will be added as needed
## **Possible workarounds depending on the use case**
None currently known other than to avoid usage of GraphQL in favor of REST