PERF: reverse index on topic users to speed up join

This commit is contained in:
Sam 2014-09-10 23:03:59 +10:00
parent ca2100d012
commit af75360942
1 changed files with 6 additions and 0 deletions

View File

@ -0,0 +1,6 @@
class CreateTopicUserIndex < ActiveRecord::Migration
def change
# seems to be the most effective for joining into topics
add_index :topic_users, [:user_id, :topic_id], unique: true
end
end