ncrypthic / doctrine-graphql

Doctrine ORM to GraphQL bridge
MIT License
2 stars 1 forks source link

Performance of queries with deep graphs #14

Open nuncanada opened 5 years ago

nuncanada commented 5 years ago

Currently to fetch the values of deep relationships, the code uses resolves with 'get'.ucfirst($resolveInfo->fieldName) path by path.

That will yield bad performance for deep graphs where you want just a few of the values.

It is much better to do a big query with a lot of joins when possible (not possible for ONE-TO-MANY and MANY-TO-MANY).

I do have working code that solves that already. Maybe I should create some library and publish it?

ncrypthic commented 5 years ago

How about leave the query side to doctrine relationship fetch attributes. Will it helps?

nuncanada commented 5 years ago

I think the correct decision would be to use the

Default Field Resolver for webonyx library.

Create a class with a method that will be used as the default callback.

Instead of all these callbacks. Once that is done, it should be easy to adapt my code to eliminate the N+1 problem. And that will eliminate the serialization problem also.