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
Improve patch/update performance with DB adapters #3365
Comments
In Mongo, there are other upgrades like using |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For most DB adapters, we have to do an initial lookup before doing the actual patch/update database method. For more context see this issue: #3363.
But, we could skip this initial lookup under certain (very common) conditions. For both patch and update, if the id is present but query is not present, then we can skip the originalId lookup. This covers the most basic, common use cases I believe.
This would result in the most common mutation methods going from 3 DB operations to 2 DB operations! While this update would add a bit more code, I think it is worth it for the performance gain. And, it would better explain why these adapters use the originalId lookup, ultimately lowering the overall "complexity" of the code because it is more obvious why/when the originalId lookup is necessary.
The text was updated successfully, but these errors were encountered: