-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize complex GraphQL queries #171
Comments
Do you feel this is this something we need try to tackle for v1.0.0 or can it wait til after? |
Not mandatory for 1.0.0 but would be good to have it for 1.1.0 if possible |
Great thanks. Just helps me prioritize the final stretch to 1.0.0-final. |
A few parts to this:
|
We are in a bit of a tight spot with this issue and module. Because of the The only way I might have found to get around this is by using This leads onto the next issue with this module, the only documentation can be found here in the README. There doesnt seem to be much support for the module, in one of the open issues you can see the owner trying to give away the project to another organisation. I think maybe if a few of us worked together to get a prototype working we might be able to, but my worry is, would it be worth it with the limited support once it works. One possibility would be taking over the module or forking and supporting it ourselves but do we want to take on that work? |
Thanks @carbonarok . We are going to close this for now. Once we have more feedback from GraphQL power users and see if there are issues, we can re-evaluate the time needed to get this going and implemented. |
@carbonarok after our last discussion I was under the impression that your branch should work so I did some testing on it and as far as I can tell it's working pretty well :) I wrote a management command to do some testing and I found some interesting results. For my testing I used a dataset similar to the sandbox and I created 4 GraphQL queries that would present different use cases. You can see the 4 queries that I used here, I named them to simplify the reporting. For each query, I measured how many SQL requests were generated, the response time with cache and without cache. Number of SQL queries generated per GraphQL queryJust by looking at the number of SQL queries generated per GraphQL query, we can see a huge optimization, in some cases a reduction of the number of queries by a factor of 100x or more
Looking at the response time, we can also see a significant improvement with Response time per GraphQL query with and without cache, without optimizationbranch
Response time per GraphQL query with and without cache, WITH optimizationbranch
I think this is pretty good, Great work @carbonarok :) |
This is I N C R E D I B L E!! The query optimization on |
Needs someone to pick up #769 and see it through to completion. |
Environment
Proposed Functionality
Leverage the ORM capabilities to query multiple results at once with
prefetch_related
andselect_related
to optimize some complex GraphQL queries and improve their response timeUse Case
A query like this one currently takes 1.87 sec (with caching) to return in the sandbox environment because we are querying the site and the region for each device.
With some optimization we should be able to return this query much faster
Database Changes
No
External Dependencies
Not sure yet but we should investigate some existing packages like graphene-django-optimizer that are trying to solve the same problem.
The text was updated successfully, but these errors were encountered: