Back to Practice

Practice · Interview · Card 1

includes vs preload vs eager_load vs joins

A classic Rails interview question. The interviewer wants four distinct behaviors named precisely, plus when you'd pick each.

The question

"Explain the difference between includes, preload, eager_load, and joins. When would you pick each one?"

Your job

Form an answer that names all four behaviors precisely and gives one clear pick for each. Don't reach for the docs.

Take a moment. Two of these issue two queries, two issue one. Two load the association, two only filter by it. Sort them out.