|
|
|
|
|
by tynorf
2012 days ago
|
|
I think the classic example is article list with author details. You load the articles (one query), then for each article you load its author (N queries). Naive use of an ORM causes this: articles = Article.load(limit=10)
for article in articles:
# .author implicitly runs a query
author_name = article.author.name
This can be avoided in ORMs providing prefetching (e.g. `Article.load(eager_load='author')`). |
|