From 66a0a89591d65eeeb691c62f0155e838e0470c40 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Fri, 3 Mar 2017 15:14:49 +0800 Subject: [PATCH] PERF: Add index to speed up `DirectoryItem.refresh_period!` query. --- db/migrate/20170303070706_add_index_to_topic_view_items.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/20170303070706_add_index_to_topic_view_items.rb diff --git a/db/migrate/20170303070706_add_index_to_topic_view_items.rb b/db/migrate/20170303070706_add_index_to_topic_view_items.rb new file mode 100644 index 00000000000..d3410816c2c --- /dev/null +++ b/db/migrate/20170303070706_add_index_to_topic_view_items.rb @@ -0,0 +1,5 @@ +class AddIndexToTopicViewItems < ActiveRecord::Migration + def change + add_index :topic_views, [:user_id, :viewed_at] + end +end