Skip to content

Commit

Permalink
Add indes on user+id to changeset and diary comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Jan 21, 2025
1 parent bd577d7 commit 3ebe31d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions db/migrate/20250121191749_add_user_comment_indexes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class AddUserCommentIndexes < ActiveRecord::Migration[7.2]
disable_ddl_transaction!

def change
add_index :changeset_comments, [:author_id, :id], :algorithm => :concurrently
add_index :diary_comments, [:user_id, :id], :algorithm => :concurrently
end
end
15 changes: 15 additions & 0 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,13 @@ CREATE UNIQUE INDEX index_active_storage_variant_records_uniqueness ON public.ac
CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at);


--
-- Name: index_changeset_comments_on_author_id_and_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_changeset_comments_on_author_id_and_id ON public.changeset_comments USING btree (author_id, id);


--
-- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -2435,6 +2442,13 @@ CREATE INDEX index_changesets_subscribers_on_changeset_id ON public.changesets_s
CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);


--
-- Name: index_diary_comments_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_diary_comments_on_user_id_and_id ON public.diary_comments USING btree (user_id, id);


--
-- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -3408,6 +3422,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('23'),
('22'),
('21'),
('20250121191749'),
('20250105154621'),
('20250104140952'),
('20241023004427'),
Expand Down

0 comments on commit 3ebe31d

Please sign in to comment.