我有一個查詢,在一次運行大量的這些,Rails 3中,熱切負荷模型
print Account.where("id%100=0").where(:has_videos=>true).count
print Account.where("id%100=1").where(:has_videos=>true).count
print Account.where("id%100=2").where(:has_videos=>true).count
,我想知道是否有使用這些方針eager_load或東西到一個點的方式這仍然很快,但只需要一次拉。
難道你不能只加載它們在一個查詢,然後打破那個結果集,只要你喜歡? – 2011-12-20 17:47:41