Commit 117df1e9 authored by Yannis Roussos's avatar Yannis Roussos

Merge branch 'mr-state-index' into 'master'

Index merge requests with state_id

See merge request gitlab-org/gitlab!42481
parents acf20ca5 272ce6ce
---
title: Add state_id index for merge_requests list
merge_request: 42481
author:
type: performance
# frozen_string_literal: true
class AddStateIdIndexToMergeRequests < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id
end
def down
remove_concurrent_index :merge_requests, [:target_project_id, :iid, :state_id], name: :index_merge_requests_on_target_project_id_and_iid_and_state_id
end
end
299e6fb38da303f06ab006a25701ff1c58ce2abfa8cf93c3c8b866ee0b2bd1cc
\ No newline at end of file
......@@ -20486,6 +20486,8 @@ CREATE INDEX index_merge_requests_on_target_project_id_and_created_at_and_id ON
CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON merge_requests USING btree (target_project_id, iid);
CREATE INDEX index_merge_requests_on_target_project_id_and_iid_and_state_id ON merge_requests USING btree (target_project_id, iid, state_id);
CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true));
CREATE INDEX index_merge_requests_on_title ON merge_requests USING btree (title);
......
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