【发布时间】:2010-10-17 16:13:20
【问题描述】:
表有列:user_id 和 season_id
哪个更快:
#If I have a database index on user_id
Table.find_all_by_user_id(some_id)
或
#If I have a database index on user_id and season_id
Table.find_all_by_user_id_and_season_id(some_id, another_id)
多列索引总是更快吗?
例如,编写多列索引是否较慢?如果是这样,我可以使用单列查询。
附言。该表有大约 1.000.000 条记录,并且还在稳步增长!
【问题讨论】:
标签: mysql ruby-on-rails indexing