Skip to content
Snippets Groups Projects

Resolve "Banzai::Filter::MergeRequestReferenceFilter has three N+1 query problems"

All threads resolved!

What does this MR do?

This merge request fixes 3 different N+1 query problems in Banzai::Filter::MergeRequestReferenceFilter.

Basically, I re-used the approach from Banzai::Filter::IssueReferenceFilter, and I had to add .includes(target_project: :namespace) for the 3rd N+1 query problem (this wasn't needed for issue, probably because the associated project's namespaces are automatically preloaded, but for merge requests, the association is named target_project instead of project so...).

Before After
before-sherlock1 after-sherlock1
before-sherlock2 after-sherlock2
before-stackprof after-stackprof

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

Does this MR meet the acceptance criteria?

Closes #30098 (closed) /cc @stanhu

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Rémy Coutable resolved all discussions

    resolved all discussions

  • Rémy Coutable added 44 commits

    added 44 commits

    • 6dc43c8e...19a44034 - 40 commits from branch master
    • 20bada33 - Add N+1 query problem specs for Issue and MergeRequest ReferenceFilter classes
    • 8e388fca - Get rid of a first N+1 query problem
    • 38efe1bf - Get rid of second N+1 query problem
    • 8efbf534 - Get rid of a third N+1 query problem

    Compare with previous version

  • Author Maintainer

    @yorickpeterse Thanks! It's all good now! :heart:

  • Yorick Peterse changed milestone to %9.0

    changed milestone to %9.0

  • Yorick Peterse added ~149423 label

    added ~149423 label

  • @rymai It seems you forgot to add a changelog entry, could you add one?

  • Rémy Coutable added 1 commit

    added 1 commit

    Compare with previous version

  • Author Maintainer

    @yorickpeterse Right, I thought this was not a user-facing change, but it actually is, indeed (https://docs.gitlab.com/ce/development/changelog.html#what-warrants-a-changelog-entry).

    Changelog added in cf394a03, I've set it as [ci skip] since the latest pipeline passed, is it ok for you?

  • Yorick Peterse approved this merge request

    approved this merge request

  • Yorick Peterse added ~159544 label

    added ~159544 label

  • Yorick Peterse mentioned in commit 1bec2fb3

    mentioned in commit 1bec2fb3

  • mentioned in issue #30318 (closed)

  • Picked into stable. Will be in 9.0.3.

  • James Lopez removed ~149423 label

    removed ~149423 label

  • Yorick Peterse mentioned in commit f064a842

    mentioned in commit f064a842

  • Please register or sign in to reply
    Loading