From 2bdceb2bf15d9f4143683b5ba1af5171d1f10318 Mon Sep 17 00:00:00 2001 From: Thomas Hutterer <thutterer@gitlab.com> Date: Fri, 19 Jan 2024 10:38:19 +0000 Subject: [PATCH] Remove duplicated index_user_callouts_on_user_id index Changelog: performance --- ...950_remove_index_user_callouts_on_user_id.rb | 17 +++++++++++++++++ db/schema_migrations/20240119102950 | 1 + db/structure.sql | 2 -- .../helpers/database/duplicate_indexes.yml | 3 --- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 db/post_migrate/20240119102950_remove_index_user_callouts_on_user_id.rb create mode 100644 db/schema_migrations/20240119102950 diff --git a/db/post_migrate/20240119102950_remove_index_user_callouts_on_user_id.rb b/db/post_migrate/20240119102950_remove_index_user_callouts_on_user_id.rb new file mode 100644 index 000000000000..cdfb5d4614f2 --- /dev/null +++ b/db/post_migrate/20240119102950_remove_index_user_callouts_on_user_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class RemoveIndexUserCalloutsOnUserId < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.9' + + INDEX_NAME = 'index_user_callouts_on_user_id' + + def up + remove_concurrent_index_by_name(:user_callouts, INDEX_NAME) + end + + def down + add_concurrent_index(:user_callouts, :user_id, name: INDEX_NAME) + end +end diff --git a/db/schema_migrations/20240119102950 b/db/schema_migrations/20240119102950 new file mode 100644 index 000000000000..af906de86e89 --- /dev/null +++ b/db/schema_migrations/20240119102950 @@ -0,0 +1 @@ +740f0d76619decc211dd950a75091c1b6766774483e42c92fd48f0d22c389a5d \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 7584786bd312..b0522d51db72 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -35650,8 +35650,6 @@ CREATE INDEX index_user_achievements_on_user_id_revoked_by_is_null ON user_achie CREATE INDEX index_user_agent_details_on_subject_id_and_subject_type ON user_agent_details USING btree (subject_id, subject_type); -CREATE INDEX index_user_callouts_on_user_id ON user_callouts USING btree (user_id); - CREATE UNIQUE INDEX index_user_callouts_on_user_id_and_feature_name ON user_callouts USING btree (user_id, feature_name); CREATE INDEX index_user_canonical_emails_on_canonical_email ON user_canonical_emails USING btree (canonical_email); diff --git a/spec/support/helpers/database/duplicate_indexes.yml b/spec/support/helpers/database/duplicate_indexes.yml index 80d409f233de..29e1c1da2454 100644 --- a/spec/support/helpers/database/duplicate_indexes.yml +++ b/spec/support/helpers/database/duplicate_indexes.yml @@ -162,9 +162,6 @@ term_agreements: todos: index_todos_on_author_id_and_created_at: - index_todos_on_author_id -user_callouts: - index_user_callouts_on_user_id_and_feature_name: - - index_user_callouts_on_user_id vulnerabilities: index_vulnerabilities_project_id_state_severity_default_branch: - index_vulnerabilities_on_project_id_and_state_and_severity -- GitLab