Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-02-10 11:01:23 +0300
committerStan Hu <stanhu@gmail.com>2017-02-10 18:51:48 +0300
commit41d7b47c3cd3357269f967548428a768a606f0f0 (patch)
treea03ee968e503c6f3646e0f423f3317bb21a700c3 /db
parentb88e82ff0a1bca9687b5579208ba05a99e41a464 (diff)
Add index to ci_trigger_requests for commit_id
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.rb11
-rw-r--r--db/schema.rb4
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"