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
7b3f6d4e
Commit
7b3f6d4e
authored
Mar 24, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize ci builds AMAU queries
Adds an index to ensure computation for the queries
parent
d8729627
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
1 deletion
+28
-1
changelogs/unreleased/208884-optimize-ci_builds-counters-in-usage-data.yml
...ased/208884-optimize-ci_builds-counters-in-usage-data.yml
+5
-0
db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb
...23122201_add_index_on_user_and_created_at_to_ci_builds.rb
+19
-0
db/structure.sql
db/structure.sql
+4
-1
No files found.
changelogs/unreleased/208884-optimize-ci_builds-counters-in-usage-data.yml
0 → 100644
View file @
7b3f6d4e
---
title
:
Optimize ci builds counters in usage data
merge_request
:
27770
author
:
type
:
performance
db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb
0 → 100644
View file @
7b3f6d4e
# frozen_string_literal: true
class
AddIndexOnUserAndCreatedAtToCiBuilds
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
INDEX_NAME
=
'index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build'
def
up
add_concurrent_index
:ci_builds
,
[
:user_id
,
:created_at
],
where:
"type = 'Ci::Build'"
,
name:
INDEX_NAME
end
def
down
remove_concurrent_index
:ci_builds
,
INDEX_NAME
end
end
db/structure.sql
View file @
7b3f6d4e
...
@@ -8603,6 +8603,8 @@ CREATE INDEX index_ci_builds_on_upstream_pipeline_id ON public.ci_builds USING b
...
@@ -8603,6 +8603,8 @@ CREATE INDEX index_ci_builds_on_upstream_pipeline_id ON public.ci_builds USING b
CREATE
INDEX
index_ci_builds_on_user_id
ON
public
.
ci_builds
USING
btree
(
user_id
);
CREATE
INDEX
index_ci_builds_on_user_id
ON
public
.
ci_builds
USING
btree
(
user_id
);
CREATE
INDEX
index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build
ON
public
.
ci_builds
USING
btree
(
user_id
,
created_at
)
WHERE
((
type
)::
text
=
'Ci::Build'
::
text
);
CREATE
INDEX
index_ci_builds_project_id_and_status_for_live_jobs_partial2
ON
public
.
ci_builds
USING
btree
(
project_id
,
status
)
WHERE
(((
type
)::
text
=
'Ci::Build'
::
text
)
AND
((
status
)::
text
=
ANY
(
ARRAY
[(
'running'
::
character
varying
)::
text
,
(
'pending'
::
character
varying
)::
text
,
(
'created'
::
character
varying
)::
text
])));
CREATE
INDEX
index_ci_builds_project_id_and_status_for_live_jobs_partial2
ON
public
.
ci_builds
USING
btree
(
project_id
,
status
)
WHERE
(((
type
)::
text
=
'Ci::Build'
::
text
)
AND
((
status
)::
text
=
ANY
(
ARRAY
[(
'running'
::
character
varying
)::
text
,
(
'pending'
::
character
varying
)::
text
,
(
'created'
::
character
varying
)::
text
])));
CREATE
UNIQUE
INDEX
index_ci_builds_runner_session_on_build_id
ON
public
.
ci_builds_runner_session
USING
btree
(
build_id
);
CREATE
UNIQUE
INDEX
index_ci_builds_runner_session_on_build_id
ON
public
.
ci_builds_runner_session
USING
btree
(
build_id
);
...
@@ -12746,5 +12748,6 @@ INSERT INTO "schema_migrations" (version) VALUES
...
@@ -12746,5 +12748,6 @@ INSERT INTO "schema_migrations" (version) VALUES
(
'20200318165448'
),
(
'20200318165448'
),
(
'20200318175008'
),
(
'20200318175008'
),
(
'20200319203901'
),
(
'20200319203901'
),
(
'20200323075043'
);
(
'20200323075043'
),
(
'20200323122201'
);
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