From ec9a3e5c1770315eb790e6f667971a9854a9ec48 Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 7 Jun 2017 23:51:02 -0500 Subject: [PATCH] posts: add partial indexes on is_pending, is_flagged. --- ...43651_add_pending_flagged_indexes_to_posts.rb | 8 ++++++++ db/structure.sql | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 db/migrate/20170608043651_add_pending_flagged_indexes_to_posts.rb diff --git a/db/migrate/20170608043651_add_pending_flagged_indexes_to_posts.rb b/db/migrate/20170608043651_add_pending_flagged_indexes_to_posts.rb new file mode 100644 index 000000000..594cf6af8 --- /dev/null +++ b/db/migrate/20170608043651_add_pending_flagged_indexes_to_posts.rb @@ -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 diff --git a/db/structure.sql b/db/structure.sql index 23da65238..546ed9767 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -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'); +