modqueue: fix performance regression from including appeals.
* Add index on posts.is_deleted. The modqueue was slow because we the appeal condition wasn't constrained to deleted posts, so it degraded to a full table scan. * Avoid extra queries for calculating the page count and disapproval counts.
This commit is contained in:
@@ -6757,6 +6757,13 @@ CREATE INDEX index_posts_on_image_height ON public.posts USING btree (image_heig
|
||||
CREATE INDEX index_posts_on_image_width ON public.posts USING btree (image_width);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_posts_on_is_deleted; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE INDEX index_posts_on_is_deleted ON public.posts USING btree (is_deleted) WHERE (is_deleted = true);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_posts_on_is_flagged; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@@ -7410,6 +7417,8 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20200403210353'),
|
||||
('20200406054838'),
|
||||
('20200427190519'),
|
||||
('20200803022359');
|
||||
('20200520060951'),
|
||||
('20200803022359'),
|
||||
('20200816175151');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user