Actions
Refactor #16245
openDon't use eager_load when not needed
Status:
New
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Description
ActiveRecord::QueryMethods#eager_load executes a LEFT OUTER JOIN and loads all table columns from all requested tables.
In many cases, an INNER JOIN will be enough as we are only interested in filtering according to the added relation and do not need all the data from that relation.
In these cases, `eager_load` should be replaced by `joins` which will perform the INNER JOIN needed and will be much more efficiant.
Actions