Commit 93ef6be6 authored by Yannis Roussos's avatar Yannis Roussos

Merge branch 'improve-compliance-merge-request-query' into 'master'

Add index for compliance merged MRs to events

See merge request gitlab-org/gitlab!38885
parents 2984b7c2 ab7bb183
---
title: Add index for compliance merged MRs to events
merge_request: 38885
author:
type: performance
# frozen_string_literal: true
class AddIndexForComplianceMergedMergeRequestToEvents < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_events_on_project_id_and_id_desc_on_merged_action'
disable_ddl_transaction!
def up
add_concurrent_index :events, [:project_id, :id],
order: { id: :desc },
where: "action = 7", name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :events, INDEX_NAME
end
end
a1fb6b5d486eee27aaed5083aa6340073bf05abab8f201fd9097374dbd345b90
\ No newline at end of file
......@@ -19600,6 +19600,8 @@ CREATE INDEX index_events_on_project_id_and_created_at ON public.events USING bt
CREATE INDEX index_events_on_project_id_and_id ON public.events USING btree (project_id, id);
CREATE INDEX index_events_on_project_id_and_id_desc_on_merged_action ON public.events USING btree (project_id, id DESC) WHERE (action = 7);
CREATE INDEX index_events_on_target_type_and_target_id ON public.events USING btree (target_type, target_id);
CREATE UNIQUE INDEX index_events_on_target_type_and_target_id_and_fingerprint ON public.events USING btree (target_type, target_id, fingerprint);
......
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