-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add totalCount field to plural connection type #954
base: main
Are you sure you want to change the base?
Conversation
Hi, thanks for opening. I'm open to this addition, but have some ideas for how to tweak it:
query {
friends(where: { id_lt: 100 }) {
items {
id
name
age
}
pageInfo {
endCursor
hasNextPage
}
totalCount # On the Page type, not the PageInfo type
}
}
|
Thanks for considering this! We can definitely move I agree that the performance considerations should be mentioned in the docs. It seems like there may be a way to use CTEs to include both queries in a single database call without too much performance overhead. Happy to investigate this if performance is a big concern. |
@0xOlias I have refactored the Let me know if there are any other changes you would like me to make! |
This PR adds an additional field
totalCount
to the connection type for all plural queries. If thetotalCount
field is included in a query, an additional database call is made to fetch the total number of unique records matching the currently appliedwhere
filters. If thetotalCount
field is not queried, no additional database calls are made.