forked from e621ng/e621ng
[DB] Add missing indexes to large tables
The favorites table was missing the user_id column in prod The post_votes table was missing the user_id column in prod The comments table was missing the creator_id column in prod The remaining indexes existed in prod, but not in the dev schema.
This commit is contained in:
parent
8869ebd8d6
commit
5843282986
@ -0,0 +1,9 @@
|
||||
class CreateMissingUserIdIndexes < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_index :favorites, :user_id
|
||||
add_index :favorites, :post_id
|
||||
add_index :post_votes, :user_id
|
||||
add_index :post_votes, :post_id
|
||||
add_index :comments, :creator_id
|
||||
end
|
||||
end
|
@ -3885,6 +3885,13 @@ CREATE INDEX index_comment_votes_on_user_id ON public.comment_votes USING btree
|
||||
CREATE INDEX index_comments_on_body_index ON public.comments USING gin (body_index);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_comments_on_creator_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_comments_on_creator_id ON public.comments USING btree (creator_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_comments_on_creator_id_and_post_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@ -3976,6 +3983,20 @@ CREATE INDEX index_favorite_groups_on_creator_id ON public.favorite_groups USING
|
||||
CREATE INDEX index_favorite_groups_on_lower_name ON public.favorite_groups USING btree (lower(name));
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_favorites_on_post_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_favorites_on_post_id ON public.favorites USING btree (post_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_favorites_on_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_favorites_on_user_id ON public.favorites USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_favorites_on_user_id_and_post_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@ -4389,6 +4410,20 @@ CREATE INDEX index_post_versions_on_updater_id ON public.post_versions USING btr
|
||||
CREATE INDEX index_post_versions_on_updater_ip_addr ON public.post_versions USING btree (updater_ip_addr);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_post_votes_on_post_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_post_votes_on_post_id ON public.post_votes USING btree (post_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_post_votes_on_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_post_votes_on_user_id ON public.post_votes USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_post_votes_on_user_id_and_post_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@ -5091,5 +5126,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20201220172926'),
|
||||
('20201220190335'),
|
||||
('20210117173030'),
|
||||
('20210405040522');
|
||||
('20210405040522'),
|
||||
('20210425020131');
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user