From adf17acef347e15d2242ab5ac49161d31a1942ba Mon Sep 17 00:00:00 2001 From: Maxime Orefice <morefice@gitlab.com> Date: Thu, 30 Jun 2022 11:00:24 +0200 Subject: [PATCH] Drop unused ci builds index Changelog: other --- ...sfull_pages_deploy_index_from_ci_builds.rb | 21 +++++++++++++++++++ db/schema_migrations/20220630085003 | 1 + db/structure.sql | 2 -- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 db/post_migrate/20220630085003_drop_project_successfull_pages_deploy_index_from_ci_builds.rb create mode 100644 db/schema_migrations/20220630085003 diff --git a/db/post_migrate/20220630085003_drop_project_successfull_pages_deploy_index_from_ci_builds.rb b/db/post_migrate/20220630085003_drop_project_successfull_pages_deploy_index_from_ci_builds.rb new file mode 100644 index 0000000000000000..0810419a4e800ea1 --- /dev/null +++ b/db/post_migrate/20220630085003_drop_project_successfull_pages_deploy_index_from_ci_builds.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class DropProjectSuccessfullPagesDeployIndexFromCiBuilds < Gitlab::Database::Migration[2.0] + disable_ddl_transaction! + + INDEX_NAME = 'index_ci_builds_on_project_id_for_successfull_pages_deploy' + + def up + remove_concurrent_index_by_name :ci_builds, INDEX_NAME + end + + # rubocop:disable Migration/PreventIndexCreation + def down + add_concurrent_index :ci_builds, + :project_id, + where: "(((type)::text = 'GenericCommitStatus'::text) AND ((stage)::text = 'deploy'::text) AND " \ + "((name)::text = 'pages:deploy'::text) AND ((status)::text = 'success'::text))", + name: INDEX_NAME + end + # rubocop:enable Migration/PreventIndexCreation +end diff --git a/db/schema_migrations/20220630085003 b/db/schema_migrations/20220630085003 new file mode 100644 index 0000000000000000..9e020afbe84bea4f --- /dev/null +++ b/db/schema_migrations/20220630085003 @@ -0,0 +1 @@ +c1fb356eb437f9511c0af324f9f4a173245a427d20e2bbda0557dfaff28911c3 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 066e594a39c652cd..f5fbc253b84a9589 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -27368,8 +27368,6 @@ CREATE INDEX index_ci_builds_on_project_id_and_id ON ci_builds USING btree (proj CREATE INDEX index_ci_builds_on_project_id_and_name_and_ref ON ci_builds USING btree (project_id, name, ref) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = 'success'::text) AND ((retried = false) OR (retried IS NULL))); -CREATE INDEX index_ci_builds_on_project_id_for_successfull_pages_deploy ON ci_builds USING btree (project_id) WHERE (((type)::text = 'GenericCommitStatus'::text) AND ((stage)::text = 'deploy'::text) AND ((name)::text = 'pages:deploy'::text) AND ((status)::text = 'success'::text)); - CREATE INDEX index_ci_builds_on_queued_at ON ci_builds USING btree (queued_at); CREATE INDEX index_ci_builds_on_resource_group_and_status_and_commit_id ON ci_builds USING btree (resource_group_id, status, commit_id) WHERE (resource_group_id IS NOT NULL); -- GitLab