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
a5e3cd7f
Commit
a5e3cd7f
authored
Mar 07, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add index on section_name_id on ci_build_trace_sections table
This was causing user deletions to time out. Closes #44008
parent
7734e85b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
changelogs/unreleased/sh-add-section-name-index.yml
changelogs/unreleased/sh-add-section-name-index.yml
+5
-0
db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
...5_add_section_name_id_index_on_ci_build_trace_sections.rb
+22
-0
db/schema.rb
db/schema.rb
+2
-1
No files found.
changelogs/unreleased/sh-add-section-name-index.yml
0 → 100644
View file @
a5e3cd7f
---
title
:
Add index on section_name_id on ci_build_trace_sections table
merge_request
:
author
:
type
:
performance
db/migrate/20180308052825_add_section_name_id_index_on_ci_build_trace_sections.rb
0 → 100644
View file @
a5e3cd7f
class
AddSectionNameIdIndexOnCiBuildTraceSections
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
def
up
# MySQL may already have this as a foreign key
unless
index_exists?
(
:ci_build_trace_sections
,
:section_name_id
)
add_concurrent_index
:ci_build_trace_sections
,
:section_name_id
end
end
def
down
# We cannot remove index for MySQL because it's needed for foreign key
if
Gitlab
::
Database
.
postgresql?
remove_concurrent_index
:ci_build_trace_sections
,
:section_name_id
end
end
end
db/schema.rb
View file @
a5e3cd7f
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2018030
701244
5
)
do
ActiveRecord
::
Schema
.
define
(
version:
2018030
805282
5
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -264,6 +264,7 @@ ActiveRecord::Schema.define(version: 20180307012445) do
add_index
"ci_build_trace_sections"
,
[
"build_id"
,
"section_name_id"
],
name:
"index_ci_build_trace_sections_on_build_id_and_section_name_id"
,
unique:
true
,
using: :btree
add_index
"ci_build_trace_sections"
,
[
"project_id"
],
name:
"index_ci_build_trace_sections_on_project_id"
,
using: :btree
add_index
"ci_build_trace_sections"
,
[
"section_name_id"
],
name:
"index_ci_build_trace_sections_on_section_name_id"
,
using: :btree
create_table
"ci_builds"
,
force: :cascade
do
|
t
|
t
.
string
"status"
...
...
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