Commit 917ab884 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '208888-optimize-service_desk_issue-counters-related-to-the-issue' into 'master'

Optimize service_desk_issue counters in usage data

See merge request gitlab-org/gitlab!26445
parents fd9b6c51 42703a65
# frozen_string_literal: true
class AddIndexOnAuthorIdAndIdAndCreatedAtToIssues < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :issues, [:author_id, :id, :created_at]
end
def down
remove_concurrent_index :issues, [:author_id, :id, :created_at]
end
end
......@@ -2207,6 +2207,7 @@ ActiveRecord::Schema.define(version: 2020_03_09_105539) do
t.integer "duplicated_to_id"
t.integer "promoted_to_epic_id"
t.integer "health_status", limit: 2
t.index ["author_id", "id", "created_at"], name: "index_issues_on_author_id_and_id_and_created_at"
t.index ["author_id"], name: "index_issues_on_author_id"
t.index ["closed_by_id"], name: "index_issues_on_closed_by_id"
t.index ["confidential"], name: "index_issues_on_confidential"
......
---
title: Optimize service desk issue counters query performance in usage data
merge_request: 26445
author:
type: performance
......@@ -281,7 +281,7 @@ module EE
projects_jira_dvcs_cloud_active: distinct_count(::Project.with_active_jira_services.with_jira_dvcs_cloud.where(time_period), :creator_id),
projects_jira_dvcs_server_active: distinct_count(::Project.with_active_jira_services.with_jira_dvcs_server.where(time_period), :creator_id),
service_desk_enabled_projects: distinct_count(::Project.with_active_services.service_desk_enabled.where(time_period), :creator_id),
service_desk_issues: distinct_count(::Issue.service_desk.where(time_period)),
service_desk_issues: count(::Issue.service_desk.where(time_period)),
todos: distinct_count(::Todo.where(time_period), :author_id)
}
end
......
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