Performance: Database query optimization
HIGH IMPACT
This affects how fast data loads from the database, impacting page load speed and responsiveness.
from sqlalchemy.orm import joinedload users = User.query.options(joinedload(User.posts)).all()
users = User.query.all() for user in users: posts = Post.query.filter_by(user_id=user.id).all()
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| N+1 Query Pattern | Minimal | Minimal | High due to delayed data | [X] Bad |
| Eager Loading with Joined Query | Minimal | Minimal | Low due to fast data fetch | [OK] Good |