.NET Data Community Standup: 8 Real-World Query Anti‑Patterns (and How to Fix Them)
TL;DR
N+1 queries are catastrophic in production — Woody and Shay Rojansky call this one of the worst anti-patterns because a harmless-looking foreach plus lazy loading can turn 1 query into hundreds once real latency and real data sizes hit.
Includehelps, but too muchIncludecauses cartesian explosions — loading multiple one-to-many collections in one query can multiply rows dramatically, soAsSplitQuery()is often the fix, though it introduces consistency tradeoffs between separate queries.EF Core now protects you from the old client-side evaluation footgun — before EF Core 3, untranslatable logic in
Wherecould silently pull entire tables into memory; now EF usually fails the query instead, except for safe projection in the finalSelect.Projection is the simplest way to stop overfetching — if a table has large columns like JSON or
nvarchar(max), selecting whole entities effectively does aSELECT *, so projecting only needed fields into anonymous types or DTOs cuts payload size fast.Offset pagination (
Skip/Take) works but keyset pagination is better — Shay argues thatSkipgets slower as offsets grow and can duplicate or miss records during concurrent updates, whileWHERE Id > lastSeenIdis both faster and more correct.The real performance battle is often in the database, not C# — the group repeatedly stresses that missing indexes, poor query plans, and extra roundtrips matter far more than tiny runtime or allocation wins, so serious teams should inspect SQL and execution plans.
The Breakdown
One bad EF Core query pattern can dwarf every micro-optimization you obsess over, and this standup walks through eight of the biggest offenders—from N+1 queries and cartesian explosions to bad pagination and missing indexes. The most useful twist is that several “fixes” have tradeoffs too, especially split queries, projection, and offset pagination.
Was This Useful?
Share
Keep Reading
Make Alcreon Yours
Tune your feedFive quick questions, and the feed ranks what matters to you first.Or just get notified
The weekly Echo. Signal worth keeping in your inbox.
Every new piece, announced on X.
Read Next
See all
Playbook
Tasteful Skills
“Tasteful Skills” argues that the best agent skills are not documentation or best-practice lists.

Playbook
The Art of Tasteful Prompting
Learn how tasteful prompting helps you move beyond generic AI output by shaping context, style, and judgment from the start.

Playbook
The Codex /goal Playbook
OpenAI shipped /goal for the Codex CLI. It turns a prompt into a persisted, self-continuing contract.