summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-01-30 12:50:47 -0800
committerStan Hu <stanhu@gmail.com>2017-01-30 12:52:25 -0800
commitfff098e4bd68bbd1ebc59720e05da887ba19f9f9 (patch)
treed0f2d4332abec688641fb5201e5ea2aae727e83e /db/migrate
parent3995baad6aeabfaba1ae5e9f867ed66ce3e6038a (diff)
downloadgitlab-ce-fff098e4bd68bbd1ebc59720e05da887ba19f9f9.tar.gz
Add project ID index to `project_authorizations` table to optimize queriessh-add-project-id-index-project-authorizations
As described in #27443, the `project_authorizations` table is often used to retrieve all team members of this project. This can lead to a number of slow queries impacting load times. This MR adds an index for just `project_id`. Closes #27443
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20170130204620_add_index_to_project_authorizations.rb11
1 files changed, 11 insertions, 0 deletions
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