diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-09-19 00:37:38 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2017-09-19 00:39:52 +0200 |
commit | 05a8f401c20e2a0b35360544aba12905239cc369 (patch) | |
tree | f85865a690e62e59725118f413ae157e7a736ba3 /db/schema.rb | |
parent | 0223d84e797c914542882646c4faa97760c1a21c (diff) | |
download | gitlab-ce-reoganize-deployment-indexes.tar.gz |
Reorganize indexes for the "deployments" tablereoganize-deployment-indexes
This removes the need for a default scope that adds a "WHERE project_id
= X" clause. This commit also includes an additional index for
Environment#last_deployment, ensuring this query uses just an index scan
instead of also applying a Filter.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36877
Diffstat (limited to 'db/schema.rb')
-rw-r--r-- | db/schema.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/db/schema.rb b/db/schema.rb index 2d8c33591f0..36f4c88ba70 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: 20170914135630) do +ActiveRecord::Schema.define(version: 20170918223303) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -506,7 +506,8 @@ ActiveRecord::Schema.define(version: 20170914135630) do end add_index "deployments", ["created_at"], name: "index_deployments_on_created_at", using: :btree - add_index "deployments", ["project_id", "environment_id", "iid"], name: "index_deployments_on_project_id_and_environment_id_and_iid", using: :btree + add_index "deployments", ["environment_id", "id"], name: "index_deployments_on_environment_id_and_id", using: :btree + add_index "deployments", ["environment_id", "iid", "project_id"], name: "index_deployments_on_environment_id_and_iid_and_project_id", using: :btree add_index "deployments", ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true, using: :btree create_table "emails", force: :cascade do |t| |