Index for multiple columns in ActiveRecord
问题 In ActiveRecord there are two ways to declare indexes for multiple columns: add_index :classifications, [:species, :family, :trivial_names] add_index :classifications, :species add_index :classifications, :family add_index :classifications, :trivial_names Is there any difference between the first approach and the second one? If so, when should I use the first and when the second? 回答1: You are comparing a composite index with a set of independent indices. They are just different. Think of it