From 7d535252199b4a106272e4a77bd050132fca893e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 1 Feb 2022 18:42:07 +0000 Subject: [PATCH] Index note comments by author and date Fixes #3443 --- .../20220201183346_add_author_index_to_note_comments.rb | 7 +++++++ db/structure.sql | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 db/migrate/20220201183346_add_author_index_to_note_comments.rb diff --git a/db/migrate/20220201183346_add_author_index_to_note_comments.rb b/db/migrate/20220201183346_add_author_index_to_note_comments.rb new file mode 100644 index 000000000..57f1f064b --- /dev/null +++ b/db/migrate/20220201183346_add_author_index_to_note_comments.rb @@ -0,0 +1,7 @@ +class AddAuthorIndexToNoteComments < ActiveRecord::Migration[6.1] + disable_ddl_transaction! + + def change + add_index :note_comments, [:author_id, :created_at], :algorithm => :concurrently + end +end diff --git a/db/structure.sql b/db/structure.sql index e50e50278..7c182189c 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2515,6 +2515,13 @@ CREATE INDEX index_issues_on_status ON public.issues USING btree (status); CREATE INDEX index_issues_on_updated_by ON public.issues USING btree (updated_by); +-- +-- Name: index_note_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_note_comments_on_author_id_and_created_at ON public.note_comments USING btree (author_id, created_at); + + -- -- Name: index_note_comments_on_body; Type: INDEX; Schema: public; Owner: - -- @@ -3425,6 +3432,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20210510083027'), ('20210510083028'), ('20210511104518'), +('20220201183346'), ('21'), ('22'), ('23'), -- 2.39.5