hoge has_many pogeの場合
Hoge.includes(:poges)
複数の場合
Hoge.includes(:poges,:ages)
ネストされたリレーションの場合
Hoge.includes(:poges,ages:[:doge,boge]) //またはcomの下にtranslationsがある場合 includes(colb: [com: :translations])
includes (ActiveRecord::QueryMethods) - APIdock
↓ちなみに
ActiveRecordでのレコード数のカウント方法
count SQLのCOUNTを使ってカウント(キャッシュ使わない length SQLの実行結果の行数をカウント(キャッシュ使う size SQLのCOUNTを使ってカウント(キャッシュ使う