Commit 261bc584 authored by Alper Akgun's avatar Alper Akgun

Merge branch 'counts-query-jira-project' into 'master'

Use joins instead of includes

See merge request gitlab-org/gitlab!74162
parents 904f5cac 588c7e45
...@@ -525,7 +525,9 @@ module EE ...@@ -525,7 +525,9 @@ module EE
min_id = minimum_id(::Integrations::JiraTrackerData.where(issues_enabled: true), :service_id) min_id = minimum_id(::Integrations::JiraTrackerData.where(issues_enabled: true), :service_id)
max_id = maximum_id(::Integrations::JiraTrackerData.where(issues_enabled: true), :service_id) max_id = maximum_id(::Integrations::JiraTrackerData.where(issues_enabled: true), :service_id)
# rubocop: enable UsageData/LargeTable: # rubocop: enable UsageData/LargeTable:
count(::Integrations::Jira.active.includes(:jira_tracker_data).where(jira_tracker_data: { issues_enabled: true }), start: min_id, finish: max_id) # rubocop: disable UsageData/DistinctCountByLargeForeignKey
distinct_count(::Integrations::Jira.active.left_outer_joins(:jira_tracker_data).where(jira_tracker_data: { issues_enabled: true }), start: min_id, finish: max_id)
# rubocop: enable UsageData/DistinctCountByLargeForeignKey
end end
# rubocop:enable CodeReuse/ActiveRecord # rubocop:enable CodeReuse/ActiveRecord
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment