Skip to content

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

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