# Eager loading

> Eager loading is an ORM technique that fetches related records together with the parent query instead of one by one.

Source: https://sqleye.com/docs/glossary/eager-loading/ · Last updated: 2026-11-29 · Publisher: CodeROG (https://coderog.com)

Eager loading is an ORM (object-relational mapper) technique that loads related records up front, together with the parent records, instead of fetching them one at a time when your code first touches them. The opposite is lazy loading.

Laravel's Eloquent documentation describes it as the remedy for the N+1 query problem. Reading each book's author in a loop runs one query per book, but `Book::with('author')->get()` runs two queries: one for the books and one for all their authors using a WHERE id IN list.

Other ORMs have equivalents under different names, so check your framework's documentation. If SQLEye flags an [N+1 query](/docs/glossary/n-plus-one-query/) group, the shape of the repeated query usually tells you which relationship to load eagerly. See [N+1 detection](/docs/live-eye/n-plus-one/).
