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

PostGraphile docs: ambiguous example in makeExtendSchemaPlugin docs #2045

Open
jemgillam opened this issue May 3, 2024 · 0 comments
Open

Comments

@jemgillam
Copy link
Contributor

Summary

https://postgraphile.org/postgraphile/next/make-extend-schema-plugin#example-2 needs fixing, add some warnings around it for context

Additional context

One of our sponsors has asked if there's a potential N+1 problem within this example, which Benjie has described as "terrible".

withPgClient by default is designed for use in mutations. It runs the query once for each entry in the batch. At the root level (as here) there is no N (we're at root) so this is fine; but if you were to add that to a non-root type (e.g. User or Post or whatever) then yes absolutely it would destroy performance. Further withPgClient is flagged as a mutation (hasSideEffects = true) and that will impact the efficiency of your plans too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 📝 Docs Improvements
Development

No branches or pull requests

1 participant