All challenges
Code AnalysisHard 60s

N+1 query in an ORM loop

What performance failure does this snippet exhibit?
Starter code
orders = db.query("SELECT id, user_id FROM orders LIMIT 100")
for o in orders:
    user = db.query("SELECT name FROM users WHERE id = ?", o.user_id)
    print(user.name)

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle