BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
118dcff0
Commit
118dcff0
authored
Aug 03, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'reorganise-issues-indexes-for-sorting' into 'master'
Re-organise "issues" indexes for faster ordering See merge request !13278
parents
57aa5d63
9b3f0569
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
3 deletions
+51
-3
reorganise-issues-indexes-for-sorting.yml
...logs/unreleased/reorganise-issues-indexes-for-sorting.yml
+4
-0
20170803130232_reorganise_issues_indexes_for_faster_sorting.rb
...803130232_reorganise_issues_indexes_for_faster_sorting.rb
+43
-0
schema.rb
db/schema.rb
+4
-3
No files found.
changelogs/unreleased/reorganise-issues-indexes-for-sorting.yml
0 → 100644
View file @
118dcff0
---
title
:
Re-organise "issues" indexes for faster ordering
merge_request
:
author
:
db/migrate/20170803130232_reorganise_issues_indexes_for_faster_sorting.rb
0 → 100644
View file @
118dcff0
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class
ReorganiseIssuesIndexesForFasterSorting
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
REMOVE_INDEX_COLUMNS
=
%i[project_id created_at due_date updated_at]
.
freeze
ADD_INDEX_COLUMNS
=
[
%i[project_id created_at id state]
,
%i[project_id due_date id state]
,
%i[project_id updated_at id state]
].
freeze
TABLE
=
:issues
def
up
add_indexes
(
ADD_INDEX_COLUMNS
)
remove_indexes
(
REMOVE_INDEX_COLUMNS
)
end
def
down
add_indexes
(
REMOVE_INDEX_COLUMNS
)
remove_indexes
(
ADD_INDEX_COLUMNS
)
end
def
add_indexes
(
columns
)
columns
.
each
do
|
column
|
add_concurrent_index
(
TABLE
,
column
)
unless
index_exists?
(
TABLE
,
column
)
end
end
def
remove_indexes
(
columns
)
columns
.
each
do
|
column
|
remove_concurrent_index
(
TABLE
,
column
)
if
index_exists?
(
TABLE
,
column
)
end
end
end
db/schema.rb
View file @
118dcff0
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20170
728101014
)
do
ActiveRecord
::
Schema
.
define
(
version:
20170
803130232
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -641,12 +641,13 @@ ActiveRecord::Schema.define(version: 20170728101014) do
add_index
"issues"
,
[
"assignee_id"
],
name:
"index_issues_on_assignee_id"
,
using: :btree
add_index
"issues"
,
[
"author_id"
],
name:
"index_issues_on_author_id"
,
using: :btree
add_index
"issues"
,
[
"confidential"
],
name:
"index_issues_on_confidential"
,
using: :btree
add_index
"issues"
,
[
"created_at"
],
name:
"index_issues_on_created_at"
,
using: :btree
add_index
"issues"
,
[
"deleted_at"
],
name:
"index_issues_on_deleted_at"
,
using: :btree
add_index
"issues"
,
[
"description"
],
name:
"index_issues_on_description_trigram"
,
using: :gin
,
opclasses:
{
"description"
=>
"gin_trgm_ops"
}
add_index
"issues"
,
[
"due_date"
],
name:
"index_issues_on_due_date"
,
using: :btree
add_index
"issues"
,
[
"milestone_id"
],
name:
"index_issues_on_milestone_id"
,
using: :btree
add_index
"issues"
,
[
"project_id"
,
"created_at"
,
"id"
,
"state"
],
name:
"index_issues_on_project_id_and_created_at_and_id_and_state"
,
using: :btree
add_index
"issues"
,
[
"project_id"
,
"due_date"
,
"id"
,
"state"
],
name:
"index_issues_on_project_id_and_due_date_and_id_and_state"
,
using: :btree
add_index
"issues"
,
[
"project_id"
,
"iid"
],
name:
"index_issues_on_project_id_and_iid"
,
unique:
true
,
using: :btree
add_index
"issues"
,
[
"project_id"
,
"updated_at"
,
"id"
,
"state"
],
name:
"index_issues_on_project_id_and_updated_at_and_id_and_state"
,
using: :btree
add_index
"issues"
,
[
"relative_position"
],
name:
"index_issues_on_relative_position"
,
using: :btree
add_index
"issues"
,
[
"state"
],
name:
"index_issues_on_state"
,
using: :btree
add_index
"issues"
,
[
"title"
],
name:
"index_issues_on_title_trigram"
,
using: :gin
,
opclasses:
{
"title"
=>
"gin_trgm_ops"
}
...
...
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