-
Notifications
You must be signed in to change notification settings - Fork 272
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
Enable generate_query_fragments
by default
#6013
base: dev
Are you sure you want to change the base?
Conversation
The router previously had `experimental_reuse_query_fragments` enabled by default when trying to optimize fragments before sending operations to subgraphs. While on occasion this algorithm can be more performant, we found that in vast majority of cases the query planner can be just as performant using `generate_query_fragments` query plan option, which also significantly reduces query size being sent to subgraphs. While the two options will produce correct responses, the queries produced internally by the query planner will differ. This change enables `generate_query_fragments` by default, while disabling `experimental_reuse_query_fragments`. You can change this behavior with the following options: ```yaml supergraph: generate_query_fragments: false experimental_reuse_query_fragments: true ```
/// Default: true | ||
#[serde(default = "default_generate_query_fragments")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove #[serde(default = "default_generate_query_fragments")]
and replace two instances of generate_query_fragments.unwrap_or_default()
in this file with generate_query_fragments.unwrap_or_else(default_generate_query_fragments)
Since the struct already has #[serde(default)]
serde will rely on the existing impl Default for Supergraph
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i felt that using unwrap_or_else
hid away the default definition. but i guess since we've got a doc comment with Default: true
it's maybe a bit more clear.
Co-authored-by: Renée <renee.kooi@apollographql.com>
✅ Docs Preview ReadyNo new or changed pages found. |
…how disabling fragment generation entirely (nobody should need to)
once #6013 lands, we'll need the code in connectors that converts fetch node operations to http calls to understand named fragments.
The router previously had
experimental_reuse_query_fragments
enabled by default when trying to optimize fragments before sending operations to subgraphs. While on occasion this algorithm can be more performant, we found that in vast majority of cases the query planner can be just as performant usinggenerate_query_fragments
query plan option, which also significantly reduces query size being sent to subgraphs. While the two options will produce correct responses, the queries produced internally by the query planner will differ.This change enables
generate_query_fragments
by default, while disablingexperimental_reuse_query_fragments
. You can change this behavior with the following options: