Menu

1 / 2

The duplicate object that cost a query: fixing an N+1 in GitLab's labels preloader

DEV Community: gitlab·Priyanshu Jha·3 days ago
#gH8RuHrs
#devtogitlab#devto#dev#group#labels
Reading 0:00
15s threshold

Sometimes a performance bug is one missing line. Sometimes the fix for it has a second bug hiding inside, one only a careful reviewer would spot. This merge request had both.

This is the story of gitlab-org/gitlab!270160 , which fixed an N+1 query in GitLab's GraphQL group labels. I'll cover what the issue was, the plan I proposed, the first fix, the review comment that changed it, and what I'd tell anyone starting out with GitLab contributions.

The issue: two extra queries for every subgroup

The issue was gitlab-org/gitlab#635535 , opened by Terri Chu. It was one of the best-written bug reports I've picked up.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.