-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Faster approach to code for reusing fragments in fetches (#2604)
* Faster approach to code for reusing fragments in fetches This commit somehwat "inverse" the way fragment reuse is tried. Before this commit, fragment reuse was tried depth-first, meaning that we tried reusing fragment on the leaf of the result set and then up on every selection. Unfortunately, doing so creates a number of subtlety that force the checks done on every selection to be somewhat costly, which adds up. This commit change the process a bit to test for fragment reuse "at the top level" first (and so always fully expanded selections), and recurse down for the part that didn't matched anything. In practice, doing so simplify things a bit due to always dealing with expanded selections, and this allow to the checks simpler and more efficient. Overall, this commit usually improves the time spend for trying fragment reuse during query planning (sometimes substantially), hence lowering query planning time. * Review feedback
- Loading branch information
Sylvain Lebresne
committed
May 30, 2023
1 parent
0cbf6a4
commit 2d44f34
Showing
8 changed files
with
1,081 additions
and
648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
"@apollo/query-planner": patch | ||
"@apollo/composition": patch | ||
"@apollo/federation-internals": patch | ||
"@apollo/gateway": patch | ||
--- | ||
|
||
Re-work the code use to try to reuse query named fragments to improve performance (thus sometimes improving query | ||
planning performance), to fix a possibly raised assertion error (with a message of form like `Cannot add selection of | ||
field X to selection set of parent type Y`), and to fix a rare issue where an interface or union field was not being | ||
queried for all the types it should be. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.