Commit 5cad2449 authored by Stan Hu's avatar Stan Hu

Drop redundant index on ci_pipelines.project_id

According to
https://gitlab.com/gitlab-com/gl-infra/infrastructure/issues/8823, there
are numerous redundant indexes for index_ci_pipelines_on_project_id:

* index_ci_pipelines_on_project_id_and_id_desc
* index_ci_pipelines_on_project_id_and_ref_and_status_and_id
* index_ci_pipelines_on_project_id_and_sha
* index_ci_pipelines_on_project_id_and_source
* index_ci_pipelines_on_project_id_and_status_and_config_source
* index_ci_pipelines_on_project_id_and_status_and_updated_at
* index_ci_pipelines_on_project_idandrefandiddesc

This index is taking 3+ GB, so let's drop it.
parent 2f270527
---
title: Drop redundant index on ci_pipelines.project_id
merge_request: 22325
author:
type: other
# frozen_string_literal: true
class DropIndexCiPipelinesOnProjectId < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
remove_concurrent_index :ci_pipelines, :project_id
end
def down
add_concurrent_index :ci_pipelines, :project_id
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_12_18_225624) do
ActiveRecord::Schema.define(version: 2019_12_29_140154) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
......@@ -871,7 +871,6 @@ ActiveRecord::Schema.define(version: 2019_12_18_225624) do
t.index ["project_id", "source"], name: "index_ci_pipelines_on_project_id_and_source"
t.index ["project_id", "status", "config_source"], name: "index_ci_pipelines_on_project_id_and_status_and_config_source"
t.index ["project_id", "status", "updated_at"], name: "index_ci_pipelines_on_project_id_and_status_and_updated_at"
t.index ["project_id"], name: "index_ci_pipelines_on_project_id"
t.index ["status"], name: "index_ci_pipelines_on_status"
t.index ["user_id"], name: "index_ci_pipelines_on_user_id"
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment