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
045d023e
Commit
045d023e
authored
Apr 14, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize projects with repositories enabled
Adds an index as well as start/finish times to optimize the counter
parent
1a30d4aa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
1 deletion
+29
-1
changelogs/unreleased/213799-optimize-usage_activity_by_stage-projects_with_repositories_enable.yml
...e_activity_by_stage-projects_with_repositories_enable.yml
+5
-0
db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb
...00408153842_add_index_on_creator_id_and_id_on_projects.rb
+17
-0
db/structure.sql
db/structure.sql
+3
-0
ee/lib/ee/gitlab/usage_data.rb
ee/lib/ee/gitlab/usage_data.rb
+4
-1
No files found.
changelogs/unreleased/213799-optimize-usage_activity_by_stage-projects_with_repositories_enable.yml
0 → 100644
View file @
045d023e
---
title
:
Optimize projects with repositories enabled usage data
merge_request
:
29117
author
:
type
:
performance
db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb
0 → 100644
View file @
045d023e
# frozen_string_literal: true
class
AddIndexOnCreatorIdAndIdOnProjects
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:projects
,
[
:creator_id
,
:id
]
end
def
down
remove_concurrent_index
:projects
,
[
:creator_id
,
:id
]
end
end
db/structure.sql
View file @
045d023e
...
...
@@ -9918,6 +9918,8 @@ CREATE INDEX index_projects_on_creator_id_and_created_at ON public.projects USIN
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_creator_id_and_id
ON
public
.
projects
USING
btree
(
creator_id
,
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
));
...
...
@@ -13131,6 +13133,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200407094005
20200407094923
20200408110856
20200408153842
20200408175424
\
.
ee/lib/ee/gitlab/usage_data.rb
View file @
045d023e
...
...
@@ -234,7 +234,10 @@ module EE
merge_requests_with_optional_codeowners:
distinct_count
(
::
ApprovalMergeRequestRule
.
code_owner_approval_optional
.
where
(
time_period
),
:merge_request_id
),
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
),
projects_with_repositories_enabled:
distinct_count
(
::
Project
.
with_repositories_enabled
.
where
(
time_period
),
:creator_id
,
start:
::
User
.
minimum
(
:id
),
finish:
::
User
.
maximum
(
: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
),
...
...
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