Help us understand the problem. What is going on with this article?

1秒で分かる joins, includes, preload, eager_load

More than 1 year has passed since last update.

1秒で分かる部分

メソッド テーブル結合 クエリ 条件絞り込み Association キャッシュ 使い所
joins INNER JOIN 1 条件絞り込み
left_join LEFT OUTER JOIN 1 条件絞り込み
eager_load LEFT OUTER JOIN 1 Assiociation先をRubyで読む
preload なし 1以上 複数Assiciationを先読みしておく場合。複雑なJOINでslow queryになるような場合
includes 場合による 1以上 場合による eager_loadかpreloadを使い分けてる

参考

bino98
人に優しいエンジニアになりたい。
https://bino98.hatenablog.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away