GitLab fixes N+1 query in GraphQL group labels preloader

A GitLab merge request, gitlab-org/gitlab!270160, resolves an N+1 query problem affecting group labels in the GraphQL API. When Group.labels was called with includeDescendantGroups set to true, it ran two extra queries for every subgroup owning a returned label. The queries stemmed from permission checks that read each group's root ancestor, which the labels preloader covered for project labels but not for group labels. The issue, reported by Terri Chu, was triggered on every call from the search_labels MCP tool. The contributor's plan was to extend the root-ancestor preload to group labels, add a regression spec, and remove a temporary query threshold so the spec would guard the fix.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in