Skip to content
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

Check for query plan similarity before going through planning #3841

Open
Geal opened this issue Sep 18, 2023 · 0 comments
Open

Check for query plan similarity before going through planning #3841

Geal opened this issue Sep 18, 2023 · 0 comments

Comments

@Geal
Copy link
Contributor

Geal commented Sep 18, 2023

In #3704, we bring improvement to the query plan cache warm up process, but it is still a task with a high impact on the CPU, so we should find ways to reduce the amount of work.
One way would be to look at the schema difference when updating, and see if it affects the query. If it does not, we can keep the query plan.
The first step here would be to check that if we reload a router's configuration without changing the schema, we keep the entire cache and planner instance (unless a configuration change affected it).
The next step would be to build upon the visitor traits we built for authorization, and use them to create a kind of query hash that covers:

  • the list of subgraphs
  • for each field type in the query, the directives (especially the federation directives)
  • for each field in the query, the directives and arguments

If a query has the same hash with the new schema, then we can keep the query plan. This requires additional work during warm up, but has the potential to avoid the entire planning process for a lot of queries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant