summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-02-13 18:04:40 +0000
committerRegis <boudinot.regis@yahoo.com>2017-02-14 15:52:38 -0700
commit500204990acbd703027462d0f1d7d483568ddc1c (patch)
tree7c964ad91953a895e38409c649884b216f92a242
parent0410ac5371e8ea12ce555f297bc7fd95c3e35877 (diff)
downloadgitlab-ce-500204990acbd703027462d0f1d7d483568ddc1c.tar.gz
Merge branch 'sh-add-labels-index' into 'master'
Add indices to improve loading of labels page Closes #25413 See merge request !9121
-rw-r--r--changelogs/unreleased/sh-add-labels-index.yml4
-rw-r--r--db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb12
-rw-r--r--db/schema.rb2
3 files changed, 18 insertions, 0 deletions
diff --git a/changelogs/unreleased/sh-add-labels-index.yml b/changelogs/unreleased/sh-add-labels-index.yml
new file mode 100644
index 00000000000..b948a75081c
--- /dev/null
+++ b/changelogs/unreleased/sh-add-labels-index.yml
@@ -0,0 +1,4 @@
+---
+title: Add indices to improve loading of labels page
+merge_request:
+author:
diff --git a/db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb b/db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb
new file mode 100644
index 00000000000..f922ed209aa
--- /dev/null
+++ b/db/migrate/20170210062829_add_index_to_labels_for_title_and_project.rb
@@ -0,0 +1,12 @@
+class AddIndexToLabelsForTitleAndProject < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def change
+ add_concurrent_index :labels, :title
+ add_concurrent_index :labels, :project_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e5e5c36b31a..1b7d0497d57 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -581,6 +581,8 @@ ActiveRecord::Schema.define(version: 20170210075922) do
add_index "labels", ["group_id", "project_id", "title"], name: "index_labels_on_group_id_and_project_id_and_title", unique: true, using: :btree
add_index "labels", ["type", "project_id"], name: "index_labels_on_type_and_project_id", using: :btree
+ add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree
+ add_index "labels", ["title"], name: "index_labels_on_title", using: :btree
create_table "lfs_objects", force: :cascade do |t|
t.string "oid", null: false