Commit 208d4aab authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'optimize-query-for-cherry-picked-merge-requests' into 'master'

Optimize query for cherry picked merge requests

See merge request gitlab-org/gitlab!58967
parents 3fe2fb13 22ecb18b
---
title: Optimize query for cherry picked merge requests
merge_request: 58967
author:
type: performance
# frozen_string_literal: true
class CreateIndexOnNotesForCherryPickedMergeRequests < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
NAME = 'index_notes_for_cherry_picked_merge_requests'
disable_ddl_transaction!
def up
add_concurrent_index :notes, [:project_id, :commit_id], where: "((noteable_type)::text = 'MergeRequest'::text)", name: NAME
end
def down
remove_concurrent_index_by_name :notes, name: NAME
end
end
6bd35117ca922fc0d9cb8cbd9b0e6d5d9216457182d5679e705c1f03eef05921
\ No newline at end of file
......@@ -23207,6 +23207,8 @@ CREATE INDEX index_non_requested_project_members_on_source_id_and_type ON member
CREATE UNIQUE INDEX index_note_diff_files_on_diff_note_id ON note_diff_files USING btree (diff_note_id);
CREATE INDEX index_notes_for_cherry_picked_merge_requests ON notes USING btree (project_id, commit_id) WHERE ((noteable_type)::text = 'MergeRequest'::text);
CREATE INDEX index_notes_on_author_id_and_created_at_and_id ON notes USING btree (author_id, created_at, id);
CREATE INDEX index_notes_on_commit_id ON notes USING btree (commit_id);
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