LyraLearn AI Learning Platform
Exams
← Module 4 Β· EF Core and Data Scenarios
🎧 Listen

The Slow Page Walkthrough

This is the most common EF Core scenario question in .NET interviews, and it opens like this: "Our candidate list page takes 9 seconds to load. Walk me through how you'd approach it." The interviewer is not testing whether you know the fix β€” they're testing whether you diagnose in order instead of guessing. A strong candidate narrates a process; a weak one blurts "add an index."

Step one: measure before touching anything

Say it out loud: "First I'd confirm where the time goes." Name your tools β€” EF Core logging (LogTo or EnableSensitiveDataLogging in dev), SQL Server Query Store or Profiler, and Application Insights if it's deployed. The single most valuable sentence in this answer: "I want to know if it's one slow query or two hundred fast ones." That sentence tells the interviewer you know the N+1 problem exists before you've even named it.

The usual suspects, in the order you'd check them

  1. N+1 queries β€” the page loops over candidates and lazily loads each one's transcripts. Fix: Include() for true object graphs, or better, a projection.
  2. Missing projection β€” the query pulls entire entities (every column, every related row) to render four columns. Fix: .Select(c => new CandidateRowVm { ... }) so SQL returns only what the screen needs. Projections also skip the change tracker entirely.
  3. Tracking overhead β€” a read-only list doesn't need change tracking. AsNoTracking() is cheap insurance on large result sets.
  4. Missing index / bad SQL β€” capture the generated SQL, look at the execution plan, check for scans on the filter and sort columns. Mention that Skip/Take paging without a supporting index still scans.

Close the loop: "Then I'd re-measure and confirm the page is fast before calling it done." Diagnose β†’ fix β†’ verify is the shape they want.

Answers that fall flat

Practice prompts

🧠 Quiz yourself on this lesson →

Ask the AI Tutor

Grounded in the course lessons β€” it cites its sources and says when it doesn't know.