Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
42703a65
Commit
42703a65
authored
Mar 09, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizes the service desk issue counter queries
Removes distinct and adds an index for batch counting in usage data
parent
ed7ae583
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
1 deletion
+24
-1
db/migrate/20200306170211_add_index_on_author_id_and_id_and_created_at_to_issues.rb
...add_index_on_author_id_and_id_and_created_at_to_issues.rb
+17
-0
db/schema.rb
db/schema.rb
+1
-0
ee/changelogs/unreleased/208888-optimize-service_desk_issue-counters-related-to-the-issue.yml
...mize-service_desk_issue-counters-related-to-the-issue.yml
+5
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-1
No files found.
db/migrate/20200306170211_add_index_on_author_id_and_id_and_created_at_to_issues.rb
0 → 100644
View file @
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
db/schema.rb
View file @
42703a65
...
...
@@ -2206,6 +2206,7 @@ ActiveRecord::Schema.define(version: 2020_03_06_170531) 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"
...
...
ee/changelogs/unreleased/208888-optimize-service_desk_issue-counters-related-to-the-issue.yml
0 → 100644
View file @
42703a65
---
title
:
Optimize service desk issue counters query performance in usage data
merge_request
:
26445
author
:
type
:
performance
ee/lib/ee/gitlab/usage_data.rb
View file @
42703a65
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment