diff options
-rw-r--r-- | changelogs/unreleased/53989-53993-remove-redundant-indices.yml | 5 | ||||
-rw-r--r-- | db/migrate/20181203154104_remove_redundant_index_for_project_mirror_data.rb | 30 | ||||
-rw-r--r-- | db/schema.rb | 2 |
3 files changed, 36 insertions, 1 deletions
diff --git a/changelogs/unreleased/53989-53993-remove-redundant-indices.yml b/changelogs/unreleased/53989-53993-remove-redundant-indices.yml new file mode 100644 index 00000000000..effede598de --- /dev/null +++ b/changelogs/unreleased/53989-53993-remove-redundant-indices.yml @@ -0,0 +1,5 @@ +--- +title: Remove index for next_execution_timestamp on project_mirror_data +merge_request: 23512 +author: +type: performance diff --git a/db/migrate/20181203154104_remove_redundant_index_for_project_mirror_data.rb b/db/migrate/20181203154104_remove_redundant_index_for_project_mirror_data.rb new file mode 100644 index 00000000000..c739826f106 --- /dev/null +++ b/db/migrate/20181203154104_remove_redundant_index_for_project_mirror_data.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveRedundantIndexForProjectMirrorData < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + remove_concurrent_index(*index_on_project_mirror_data) + end + + def down + add_concurrent_index(*index_on_project_mirror_data) + end + + private + + def index_on_project_mirror_data + [ + :project_mirror_data, + [:next_execution_timestamp], + { name: 'index_project_mirror_data_on_next_execution_timestamp' } + ] + end +end diff --git a/db/schema.rb b/db/schema.rb index 995619bdc69..167bf05a40f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20181126153547) do +ActiveRecord::Schema.define(version: 20181203154104) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" |