summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2018-11-27 10:32:15 +0000
committerSean McGivern <sean@gitlab.com>2018-11-27 10:32:15 +0000
commit195e33719ef217208a030b30f617cd3314d1365b (patch)
treeaa54a1bf7a0b9c4f99145ef0c4e5763b3e74bce0
parentb18556f0adbd05151c026146a7929ac830ca4bc6 (diff)
parentc09fd53e54344bead8686a5c7fbb2da05bea0adc (diff)
downloadgitlab-ce-195e33719ef217208a030b30f617cd3314d1365b.tar.gz
Merge branch '53988-remove-notes-index-on-updated-at' into 'master'
Remove notes index on updated_at Closes #53988 See merge request gitlab-org/gitlab-ce!23356
-rw-r--r--changelogs/unreleased/53988-remove-notes-index-on-updated-at.yml5
-rw-r--r--db/migrate/20181126153547_remove_notes_index_on_updated_at.rb32
-rw-r--r--db/schema.rb3
3 files changed, 38 insertions, 2 deletions
diff --git a/changelogs/unreleased/53988-remove-notes-index-on-updated-at.yml b/changelogs/unreleased/53988-remove-notes-index-on-updated-at.yml
new file mode 100644
index 00000000000..f0bbf69736d
--- /dev/null
+++ b/changelogs/unreleased/53988-remove-notes-index-on-updated-at.yml
@@ -0,0 +1,5 @@
+---
+title: Remove index for notes on updated_at
+merge_request: 23356
+author:
+type: performance
diff --git a/db/migrate/20181126153547_remove_notes_index_on_updated_at.rb b/db/migrate/20181126153547_remove_notes_index_on_updated_at.rb
new file mode 100644
index 00000000000..d7ca46b50e4
--- /dev/null
+++ b/db/migrate/20181126153547_remove_notes_index_on_updated_at.rb
@@ -0,0 +1,32 @@
+# 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 RemoveNotesIndexOnUpdatedAt < ActiveRecord::Migration[5.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index(*index_arguments)
+ end
+
+ def down
+ add_concurrent_index(*index_arguments)
+ end
+
+ private
+
+ def index_arguments
+ [
+ :notes,
+ [:updated_at],
+ {
+ name: 'index_notes_on_updated_at'
+ }
+ ]
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index acabd7b442b..7414aaee2ee 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: 20181126150622) do
+ActiveRecord::Schema.define(version: 20181126153547) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -1392,7 +1392,6 @@ ActiveRecord::Schema.define(version: 20181126150622) do
t.index ["noteable_id", "noteable_type"], name: "index_notes_on_noteable_id_and_noteable_type", using: :btree
t.index ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree
t.index ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree
- t.index ["updated_at"], name: "index_notes_on_updated_at", using: :btree
end
create_table "notification_settings", force: :cascade do |t|