Commit 26ec1a45 authored by Felipe Artur's avatar Felipe Artur Committed by Adam Hegyi

Add index to support epics filtering by award emoji

Database optimizations to support epics filtering by
award emoji.
parent e50d2168
---
title: Add composite index to support epic filtering by award emoji
merge_request: 57759
author:
type: performance
# frozen_string_literal: true
class AddCompositeIndexToAwardEmoji < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id'
disable_ddl_transaction!
def up
add_concurrent_index :award_emoji, %i[user_id name awardable_type awardable_id], name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :award_emoji, INDEX_NAME
end
end
# frozen_string_literal: true
class RemoveDeprecatedIndexFromAwardEmoji < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_award_emoji_on_user_id_and_name'
disable_ddl_transaction!
def up
# Index deprecated in favor of idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id
remove_concurrent_index_by_name(:award_emoji, INDEX_NAME)
end
def down
add_concurrent_index(:award_emoji, [:user_id, :name], name: INDEX_NAME)
end
end
d0f5341d76183882b68583bc012154566e99050c24a90c9b895d6863ad8f3273
\ No newline at end of file
d8a17ce963801559292265dd0a997d8dbc69d2fa8b8840622490f878bf1eaa6a
\ No newline at end of file
......@@ -21762,6 +21762,8 @@ CREATE INDEX idx_audit_events_on_entity_id_desc_author_id_created_at ON audit_ev
CREATE INDEX idx_audit_events_part_on_entity_id_desc_author_id_created_at ON ONLY audit_events USING btree (entity_id, entity_type, id DESC, author_id, created_at);
CREATE INDEX idx_award_emoji_on_user_emoji_name_awardable_type_awardable_id ON award_emoji USING btree (user_id, name, awardable_type, awardable_id);
CREATE INDEX idx_ci_pipelines_artifacts_locked ON ci_pipelines USING btree (ci_ref_id, id) WHERE (locked = 1);
CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON container_expiration_policies USING btree (project_id, next_run_at, enabled);
......@@ -22004,8 +22006,6 @@ CREATE INDEX index_authentication_events_on_user_id ON authentication_events USI
CREATE INDEX index_award_emoji_on_awardable_type_and_awardable_id ON award_emoji USING btree (awardable_type, awardable_id);
CREATE INDEX index_award_emoji_on_user_id_and_name ON award_emoji USING btree (user_id, name);
CREATE UNIQUE INDEX index_aws_roles_on_role_external_id ON aws_roles USING btree (role_external_id);
CREATE UNIQUE INDEX index_aws_roles_on_user_id ON aws_roles USING btree (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