Commit c68e0b98 authored by Jason Goodman's avatar Jason Goodman Committed by Tiger Watson

Add Migration to Index members on user_id, source_id, and source_type

parent 2c9ac85a
---
title: Add migration to index members on user_id, source_id, and source_type
merge_request: 59051
author:
type: performance
# frozen_string_literal: true
class IndexMembersOnUserIdSourceIdSourceType < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
INDEX_NAME = 'index_members_on_user_id_source_id_source_type'
def up
add_concurrent_index(:members, [:user_id, :source_id, :source_type], name: INDEX_NAME)
end
def down
remove_concurrent_index_by_name(:members, INDEX_NAME)
end
end
# frozen_string_literal: true
class RemoveMembersIndexOnUserId < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
INDEX_NAME = 'index_members_on_user_id'
def up
remove_concurrent_index_by_name(:members, INDEX_NAME)
end
def down
add_concurrent_index(:members, :user_id, name: INDEX_NAME)
end
end
3655b51b9975a73f3b141f53a0e89aba5b90a030abb8f1dfec3d3bcbb08aa1ec
\ No newline at end of file
1ecd19849ca362a360719c46893f793ffc52b08bd85603305e3fd4d43f3b7ef2
\ No newline at end of file
......@@ -23018,10 +23018,10 @@ CREATE INDEX index_members_on_requested_at ON members USING btree (requested_at)
CREATE INDEX index_members_on_source_id_and_source_type ON members USING btree (source_id, source_type);
CREATE INDEX index_members_on_user_id ON members USING btree (user_id);
CREATE INDEX index_members_on_user_id_created_at ON members USING btree (user_id, created_at) WHERE ((ldap = true) AND ((type)::text = 'GroupMember'::text) AND ((source_type)::text = 'Namespace'::text));
CREATE INDEX index_members_on_user_id_source_id_source_type ON members USING btree (user_id, source_id, source_type);
CREATE INDEX index_merge_request_assignees_on_merge_request_id ON merge_request_assignees USING btree (merge_request_id);
CREATE UNIQUE INDEX index_merge_request_assignees_on_merge_request_id_and_user_id ON merge_request_assignees USING btree (merge_request_id, user_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