Skip to content

Use cached values to compute total issues count in milestone index pages

username-removed-378947 requested to merge reduce-queries-milestone-index into master

What does this MR do?

Milestoneish#issues_visible_to_user caches only the ActiveRecord relation, not the actual result. Introduce Milestoneish#total_issues_count that relies on the cached method Milestoneish#count_issues_by_state to reduce the number of queries.

It's basically a follow-up to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8146.

Versions affected

8.13, 8.14. 8.15

Why was this MR needed?

Performance issues described in https://gitlab.com/gitlab-org/gitlab-ce/issues/25748.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Refers to https://gitlab.com/gitlab-org/gitlab-ce/issues/25748

Merge request reports

Loading