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
335222ba
Commit
335222ba
authored
Nov 10, 2020
by
Magdalena Frankiewicz
Committed by
Adam Hegyi
Nov 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add NULLS LAST to index on merge request metrics
To improve the sort performance
parent
cf36f02d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
2 deletions
+28
-2
changelogs/unreleased/add-nulls-last-to-db-index.yml
changelogs/unreleased/add-nulls-last-to-db-index.yml
+5
-0
db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb
...201110133629_change_index_mr_metrics_target_project_id.rb
+20
-0
db/schema_migrations/20201110133629
db/schema_migrations/20201110133629
+1
-0
db/structure.sql
db/structure.sql
+2
-2
No files found.
changelogs/unreleased/add-nulls-last-to-db-index.yml
0 → 100644
View file @
335222ba
---
title
:
Add NULLS LAST to index on merge request metrics
merge_request
:
47300
author
:
type
:
performance
db/migrate/20201110133629_change_index_mr_metrics_target_project_id.rb
0 → 100644
View file @
335222ba
# frozen_string_literal: true
class
ChangeIndexMrMetricsTargetProjectId
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
INDEX_NAME
=
'index_merge_request_metrics_on_target_project_id_merged_at'
NULLS_LAST_INDEX_NAME
=
'index_mr_metrics_on_target_project_id_merged_at_nulls_last'
def
up
add_concurrent_index
:merge_request_metrics
,
[
:target_project_id
,
:merged_at
],
order:
{
merged_at:
'DESC NULLS LAST'
},
name:
NULLS_LAST_INDEX_NAME
remove_concurrent_index_by_name
(
:merge_request_metrics
,
INDEX_NAME
)
end
def
down
add_concurrent_index
:merge_request_metrics
,
[
:target_project_id
,
:created_at
,
:merged_at
],
name:
INDEX_NAME
remove_concurrent_index_by_name
(
:merge_request_metrics
,
NULLS_LAST_INDEX_NAME
)
end
end
db/schema_migrations/20201110133629
0 → 100644
View file @
335222ba
83773b825db9b2671fd4ffb2c0d6733036737385ce7a933040011026b34ba1e1
\ No newline at end of file
db/structure.sql
View file @
335222ba
...
...
@@ -21108,8 +21108,6 @@ CREATE INDEX index_merge_request_metrics_on_pipeline_id ON merge_request_metrics
CREATE
INDEX
index_merge_request_metrics_on_target_project_id
ON
merge_request_metrics
USING
btree
(
target_project_id
);
CREATE
INDEX
index_merge_request_metrics_on_target_project_id_merged_at
ON
merge_request_metrics
USING
btree
(
target_project_id
,
merged_at
);
CREATE
UNIQUE
INDEX
index_merge_request_reviewers_on_merge_request_id_and_user_id
ON
merge_request_reviewers
USING
btree
(
merge_request_id
,
user_id
);
CREATE
INDEX
index_merge_request_reviewers_on_user_id
ON
merge_request_reviewers
USING
btree
(
user_id
);
...
...
@@ -21194,6 +21192,8 @@ CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_requ
CREATE
UNIQUE
INDEX
index_mr_context_commits_on_merge_request_id_and_sha
ON
merge_request_context_commits
USING
btree
(
merge_request_id
,
sha
);
CREATE
INDEX
index_mr_metrics_on_target_project_id_merged_at_nulls_last
ON
merge_request_metrics
USING
btree
(
target_project_id
,
merged_at
DESC
NULLS
LAST
);
CREATE
UNIQUE
INDEX
index_namespace_aggregation_schedules_on_namespace_id
ON
namespace_aggregation_schedules
USING
btree
(
namespace_id
);
CREATE
UNIQUE
INDEX
index_namespace_root_storage_statistics_on_namespace_id
ON
namespace_root_storage_statistics
USING
btree
(
namespace_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