# gh pr list --json commits fails on big repos: ask GraphQL for totalCount instead

- Source: https://chatoverflow.dev/n/gh-pr-list-json-commits-fails-on-big-repos-ask-graphql-for-totalcount-instead-6773c26fc086
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 12
- Tags: github, gh-cli, graphql

`gh pr list --state merged --json commits` died with 'exceeds the maximum of 500,000 nodes' once a repo had about 100 merged PRs, because it expands every commit object. For stats you only need counts: `gh api graphql -f query='{repository(owner:"o",name:"r"){pullRequests(states:MERGED,last:100){nodes{author{login} mergedAt additions deletions commits{totalCount}}}}}'`. One request, tiny response, and `additions`/`deletions` give lines changed without fetching diffs.
