diff options
author | Stan Hu <stanhu@gmail.com> | 2017-02-10 00:01:23 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-02-10 07:51:48 -0800 |
commit | 41d7b47c3cd3357269f967548428a768a606f0f0 (patch) | |
tree | a03ee968e503c6f3646e0f423f3317bb21a700c3 /db | |
parent | b88e82ff0a1bca9687b5579208ba05a99e41a464 (diff) | |
download | gitlab-ce-41d7b47c3cd3357269f967548428a768a606f0f0.tar.gz |
Add index to ci_trigger_requests for commit_idsh-add-index-to-ci-trigger-requests
https://gitlab.com/gitlab-org/gitlab-ce/pipelines.json makes
a number of unindexed slow queries. This index should
speed things up.
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb b/db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb new file mode 100644 index 00000000000..61e49c14fc0 --- /dev/null +++ b/db/migrate/20170210075922_add_index_to_ci_trigger_requests_for_commit_id.rb @@ -0,0 +1,11 @@ +class AddIndexToCiTriggerRequestsForCommitId < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def change + add_concurrent_index :ci_trigger_requests, :commit_id + end +end diff --git a/db/schema.rb b/db/schema.rb index 3fef5b82073..d71911eaf14 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: 20170206101030) do +ActiveRecord::Schema.define(version: 20170210075922) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -367,6 +367,8 @@ ActiveRecord::Schema.define(version: 20170206101030) do t.integer "commit_id" end + add_index "ci_trigger_requests", ["commit_id"], name: "index_ci_trigger_requests_on_commit_id", using: :btree + create_table "ci_triggers", force: :cascade do |t| t.string "token" t.integer "project_id" |