posts: add partial indexes on is_pending, is_flagged.

This commit is contained in:
evazion 2017-06-07 23:51:02 -05:00
parent bb0be36f05
commit ec9a3e5c17
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,8 @@
class AddPendingFlaggedIndexesToPosts < ActiveRecord::Migration
def change
Post.without_timeout do
add_index :posts, :is_pending, where: "is_pending = true"
add_index :posts, :is_flagged, where: "is_flagged = true"
end
end
end

View File

@ -6892,6 +6892,20 @@ CREATE INDEX index_posts_on_image_height ON posts USING btree (image_height);
CREATE INDEX index_posts_on_image_width ON posts USING btree (image_width);
--
-- Name: index_posts_on_is_flagged; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_posts_on_is_flagged ON posts USING btree (is_flagged) WHERE (is_flagged = true);
--
-- Name: index_posts_on_is_pending; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_posts_on_is_pending ON posts USING btree (is_pending) WHERE (is_pending = true);
--
-- Name: index_posts_on_last_comment_bumped_at; Type: INDEX; Schema: public; Owner: -
--
@ -7549,3 +7563,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170519204506');
INSERT INTO schema_migrations (version) VALUES ('20170526183928');
INSERT INTO schema_migrations (version) VALUES ('20170608043651');