From fcc5521f63dec8f6eb2b2d18d7a7b725a6d8464f Mon Sep 17 00:00:00 2001 From: evazion Date: Wed, 29 Mar 2017 14:16:09 -0500 Subject: [PATCH] db: add updated_at index on wiki pages. The wiki pages sidebar is ordered by updated_at. The sidebar is present on all wiki pages, so this improves load times for all wikis. --- .../20170329185605_add_updated_at_index_on_wiki_pages.rb | 7 +++++++ db/structure.sql | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 db/migrate/20170329185605_add_updated_at_index_on_wiki_pages.rb diff --git a/db/migrate/20170329185605_add_updated_at_index_on_wiki_pages.rb b/db/migrate/20170329185605_add_updated_at_index_on_wiki_pages.rb new file mode 100644 index 000000000..0dfebb6bb --- /dev/null +++ b/db/migrate/20170329185605_add_updated_at_index_on_wiki_pages.rb @@ -0,0 +1,7 @@ +class AddUpdatedAtIndexOnWikiPages < ActiveRecord::Migration + def change + WikiPage.without_timeout do + add_index :wiki_pages, :updated_at + end + end +end diff --git a/db/structure.sql b/db/structure.sql index 7d30fe328..6789bdb88 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -7217,6 +7217,13 @@ CREATE UNIQUE INDEX index_wiki_pages_on_title ON wiki_pages USING btree (title); CREATE INDEX index_wiki_pages_on_title_pattern ON wiki_pages USING btree (title text_pattern_ops); +-- +-- Name: index_wiki_pages_on_updated_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_wiki_pages_on_updated_at ON wiki_pages USING btree (updated_at); + + -- -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: - -- @@ -7562,3 +7569,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170316224630'); INSERT INTO schema_migrations (version) VALUES ('20170319000519'); +INSERT INTO schema_migrations (version) VALUES ('20170329185605'); +