From 633b52cb3f3ac13a9a8db16003fa479f501285ec Mon Sep 17 00:00:00 2001 From: Braulio Bhavamitra Date: Tue, 8 Jul 2014 09:22:52 -0300 Subject: [PATCH] Speed up articles fetch --- db/migrate/20140708121356_index_articles_filtered_fields.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) create mode 100644 db/migrate/20140708121356_index_articles_filtered_fields.rb diff --git a/db/migrate/20140708121356_index_articles_filtered_fields.rb b/db/migrate/20140708121356_index_articles_filtered_fields.rb new file mode 100644 index 0000000..9e91842 --- /dev/null +++ b/db/migrate/20140708121356_index_articles_filtered_fields.rb @@ -0,0 +1,13 @@ +class IndexArticlesFilteredFields < ActiveRecord::Migration + def self.up + %w[articles article_versions].each do |table| + add_index table, [:parent_id] + add_index table, [:path] + add_index table, [:path, :profile_id] + end + add_index :articles, [:type] + add_index :articles, [:type, :parent_id] + add_index :articles, [:type, :profile_id] + end + +end -- libgit2 0.21.2