summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-11-07 11:06:35 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2016-11-07 11:06:35 +0000
commit717b8a769245d5255adc70c0cac78fa148b38778 (patch)
tree9b8c5d4b2471977cbad2ed8f2b96a4dc32d399b8
parentda4bba24fae3c2566139cdf90f3b8a4b9c6ee141 (diff)
parenta8f2fceadd60db759522c5669b99e68029df912e (diff)
downloadgitlab-ce-717b8a769245d5255adc70c0cac78fa148b38778.tar.gz
Merge branch 'add-project-import-data-index' into 'master'
Add an index for project_id in project_import_data to improve See merge request !7316
-rw-r--r--changelogs/unreleased/add-project-import-data-index.yml4
-rw-r--r--db/migrate/20161106185620_add_project_import_data_project_index.rb12
-rw-r--r--db/schema.rb4
3 files changed, 19 insertions, 1 deletions
diff --git a/changelogs/unreleased/add-project-import-data-index.yml b/changelogs/unreleased/add-project-import-data-index.yml
new file mode 100644
index 00000000000..f5e4005f544
--- /dev/null
+++ b/changelogs/unreleased/add-project-import-data-index.yml
@@ -0,0 +1,4 @@
+---
+title: Add an index for project_id in project_import_data to improve performance
+merge_request:
+author:
diff --git a/db/migrate/20161106185620_add_project_import_data_project_index.rb b/db/migrate/20161106185620_add_project_import_data_project_index.rb
new file mode 100644
index 00000000000..750a6a8c51e
--- /dev/null
+++ b/db/migrate/20161106185620_add_project_import_data_project_index.rb
@@ -0,0 +1,12 @@
+class AddProjectImportDataProjectIndex < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def change
+ add_concurrent_index :project_import_data, :project_id
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 5476b0c93e5..212b0ed1c58 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20161103171205) do
+ActiveRecord::Schema.define(version: 20161106185620) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -867,6 +867,8 @@ ActiveRecord::Schema.define(version: 20161103171205) do
t.string "encrypted_credentials_salt"
end
+ add_index "project_import_data", ["project_id"], name: "index_project_import_data_on_project_id", using: :btree
+
create_table "projects", force: :cascade do |t|
t.string "name"
t.string "path"