summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-01-30 23:26:58 +0000
committerDJ Mountney <david@twkie.net>2017-01-31 12:33:14 -0800
commite3be216a565b05b0efec54ef23595269a61d11eb (patch)
treec7509fa603964e12c75dfe8ce0a74a20c70d7993
parent061a0703116747552282f2f1e6160f42116a9f34 (diff)
downloadgitlab-ce-e3be216a565b05b0efec54ef23595269a61d11eb.tar.gz
Merge branch 'sh-add-project-id-index-project-authorizations' into 'master'
Add project ID index to `project_authorizations` table to optimize queries Closes #27443 See merge request !8890
-rw-r--r--changelogs/unreleased/sh-add-project-id-index-project-authorizations.yml4
-rw-r--r--db/migrate/20170130204620_add_index_to_project_authorizations.rb11
-rw-r--r--db/schema.rb3
3 files changed, 17 insertions, 1 deletions
diff --git a/changelogs/unreleased/sh-add-project-id-index-project-authorizations.yml b/changelogs/unreleased/sh-add-project-id-index-project-authorizations.yml
new file mode 100644
index 00000000000..e69fcd2aa63
--- /dev/null
+++ b/changelogs/unreleased/sh-add-project-id-index-project-authorizations.yml
@@ -0,0 +1,4 @@
+---
+title: Add project ID index to `project_authorizations` table to optimize queries
+merge_request:
+author:
diff --git a/db/migrate/20170130204620_add_index_to_project_authorizations.rb b/db/migrate/20170130204620_add_index_to_project_authorizations.rb
new file mode 100644
index 00000000000..e9a0aee4d6a
--- /dev/null
+++ b/db/migrate/20170130204620_add_index_to_project_authorizations.rb
@@ -0,0 +1,11 @@
+class AddIndexToProjectAuthorizations < ActiveRecord::Migration
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:project_authorizations, :project_id)
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3c836db27fc..5efb4f6595c 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: 20170121130655) do
+ActiveRecord::Schema.define(version: 20170130204620) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -874,6 +874,7 @@ ActiveRecord::Schema.define(version: 20170121130655) do
t.integer "access_level"
end
+ add_index "project_authorizations", ["project_id"], name: "index_project_authorizations_on_project_id", using: :btree
add_index "project_authorizations", ["user_id", "project_id", "access_level"], name: "index_project_authorizations_on_user_id_project_id_access_level", unique: true, using: :btree
create_table "project_features", force: :cascade do |t|