HomeChallengesRepsProblemsLeaderboardTake a challenge

The query that ran four hundred times

A list endpoint that looks like one query and is four hundred. Fix it twice: once by projecting to exactly what the response needs, and once for the case where whole entities really are required.

Intermediate20 min on the clock5 graded checks · 100 pointsPersistence with EF Core
Graded by reading your code against the checklist below.

What you build

  • Project to a summary type rather than loading whole orders
  • Compute the count and the total in the query, not in memory
  • Where entities are needed, Include the related data
  • Split the query when two collections are included
  • Read paths do not track

Done means

One statement for the summary path, and a bounded number for the entity path.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. The summary is projected in the query+25Querying a database
  2. Count and total are computed by the database+20Querying a database
  3. The entity path includes what it needs+25Querying a database
  4. Two collections are split into two statements+20Querying a database
  5. Neither read path tracks+10Querying a database

What it teaches

The rest of Persistence with EF Core