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
412b3cb8
Commit
412b3cb8
authored
Mar 12, 2020
by
Doug Stull
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add index for optimizing service desk counter
- needed for usage ping counts
parent
21b2953d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
changelogs/unreleased/208887-optimize-project-counters-service-desk.yml
...eleased/208887-optimize-project-counters-service-desk.yml
+5
-0
db/migrate/20200312163407_add_index_on_id_and_service_desk_enabled_to_projects.rb
...7_add_index_on_id_and_service_desk_enabled_to_projects.rb
+18
-0
db/schema.rb
db/schema.rb
+2
-1
No files found.
changelogs/unreleased/208887-optimize-project-counters-service-desk.yml
0 → 100644
View file @
412b3cb8
---
title
:
Optimize Project related count service desk enabled
merge_request
:
27115
author
:
type
:
performance
db/migrate/20200312163407_add_index_on_id_and_service_desk_enabled_to_projects.rb
0 → 100644
View file @
412b3cb8
# frozen_string_literal: true
class
AddIndexOnIdAndServiceDeskEnabledToProjects
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
INDEX_NAME
=
'index_projects_on_id_service_desk_enabled'
disable_ddl_transaction!
def
up
add_concurrent_index
:projects
,
:id
,
where:
'service_desk_enabled = true'
,
name:
INDEX_NAME
end
def
down
remove_concurrent_index_by_name
:projects
,
INDEX_NAME
end
end
db/schema.rb
View file @
412b3cb8
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2020_03_1
1_165635
)
do
ActiveRecord
::
Schema
.
define
(
version:
2020_03_1
2_163407
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_trgm"
...
...
@@ -3485,6 +3485,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do
t
.
index
[
"id"
,
"repository_storage"
,
"last_repository_updated_at"
],
name:
"idx_projects_on_repository_storage_last_repository_updated_at"
t
.
index
[
"id"
],
name:
"index_on_id_partial_with_legacy_storage"
,
where:
"((storage_version < 2) OR (storage_version IS NULL))"
t
.
index
[
"id"
],
name:
"index_projects_on_id_partial_for_visibility"
,
unique:
true
,
where:
"(visibility_level = ANY (ARRAY[10, 20]))"
t
.
index
[
"id"
],
name:
"index_projects_on_id_service_desk_enabled"
,
where:
"(service_desk_enabled = true)"
t
.
index
[
"id"
],
name:
"index_projects_on_mirror_and_mirror_trigger_builds_both_true"
,
where:
"((mirror IS TRUE) AND (mirror_trigger_builds IS TRUE))"
t
.
index
[
"last_activity_at"
,
"id"
],
name:
"index_projects_api_last_activity_at_id_desc"
,
order:
{
id: :desc
}
t
.
index
[
"last_activity_at"
,
"id"
],
name:
"index_projects_api_vis20_last_activity_at"
,
where:
"(visibility_level = 20)"
...
...
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