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
f34afbef
Commit
f34afbef
authored
Apr 08, 2020
by
alinamihaila
Committed by
Toon Claes
Apr 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize protected branches usage data
parent
eea793bc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
1 deletion
+26
-1
db/migrate/20200408175424_add_index_on_creator_id_created_at_id_to_projects_table.rb
...dd_index_on_creator_id_created_at_id_to_projects_table.rb
+17
-0
db/structure.sql
db/structure.sql
+3
-0
ee/changelogs/unreleased/213800-optimize-usage_activity_by_stage-create-protected_branches.yml
...ize-usage_activity_by_stage-create-protected_branches.yml
+5
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+1
-1
No files found.
db/migrate/20200408175424_add_index_on_creator_id_created_at_id_to_projects_table.rb
0 → 100644
View file @
f34afbef
# frozen_string_literal: true
class
AddIndexOnCreatorIdCreatedAtIdToProjectsTable
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:projects
,
[
:creator_id
,
:created_at
,
:id
]
end
def
down
remove_concurrent_index
:projects
,
[
:creator_id
,
:created_at
,
:id
]
end
end
db/structure.sql
View file @
f34afbef
...
...
@@ -9884,6 +9884,8 @@ CREATE INDEX index_projects_on_created_at_and_id ON public.projects USING btree
CREATE
INDEX
index_projects_on_creator_id_and_created_at
ON
public
.
projects
USING
btree
(
creator_id
,
created_at
);
CREATE
INDEX
index_projects_on_creator_id_and_created_at_and_id
ON
public
.
projects
USING
btree
(
creator_id
,
created_at
,
id
);
CREATE
INDEX
index_projects_on_description_trigram
ON
public
.
projects
USING
gin
(
description
public
.
gin_trgm_ops
);
CREATE
INDEX
index_projects_on_id_and_archived_and_pending_delete
ON
public
.
projects
USING
btree
(
id
)
WHERE
((
archived
=
false
)
AND
(
pending_delete
=
false
));
...
...
@@ -13092,5 +13094,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200407094005
20200407094923
20200408110856
20200408175424
\
.
ee/changelogs/unreleased/213800-optimize-usage_activity_by_stage-create-protected_branches.yml
0 → 100644
View file @
f34afbef
---
title
:
Optimize protected branches usage data
merge_request
:
29148
author
:
type
:
performance
ee/lib/ee/gitlab/usage_data.rb
View file @
f34afbef
...
...
@@ -235,7 +235,7 @@ module EE
merge_requests_with_required_codeowners:
distinct_count
(
::
ApprovalMergeRequestRule
.
code_owner_approval_required
.
where
(
time_period
),
:merge_request_id
),
projects_imported_from_github:
distinct_count
(
::
Project
.
github_imported
.
where
(
time_period
),
:creator_id
),
projects_with_repositories_enabled:
distinct_count
(
::
Project
.
with_repositories_enabled
.
where
(
time_period
),
:creator_id
),
protected_branches:
distinct_count
(
::
Project
.
with_protected_branches
.
where
(
time_period
),
:creator_id
),
protected_branches:
distinct_count
(
::
Project
.
with_protected_branches
.
where
(
time_period
),
:creator_id
,
start:
::
User
.
minimum
(
:id
),
finish:
::
User
.
maximum
(
:id
)
),
remote_mirrors:
distinct_count
(
::
Project
.
with_remote_mirrors
.
where
(
time_period
),
:creator_id
),
snippets:
distinct_count
(
::
Snippet
.
where
(
time_period
),
:author_id
),
suggestions:
distinct_count
(
::
Note
.
with_suggestions
.
where
(
time_period
),
...
...
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