Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 22
    • Issues 22
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !10252

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

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Rémy Coutable requested to merge 30098-banzai-filter-mergerequestreferencefilter-has-an-n-1-query-problem into master Mar 27, 2017
  • Overview 8
  • Commits 5
  • Pipelines 4
  • Changes 4

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?

  • No Changelog entry needed.
  • Tests
    • Added for this feature/bug
    • All builds are passing
  • Conform by the merge request performance guides
  • Conform by the style guides
  • Branch has no merge conflicts with master (if it does - rebase it please)
  • Squashed related commits together

Closes #30098 (closed) /cc @stanhu

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: 30098-banzai-filter-mergerequestreferencefilter-has-an-n-1-query-problem