Skip to content
Katabench
Try free

Topic

Databases & EF Core

EF Core and database engineering from query shape and indexes to concurrency, pagination, and connection management.

7 min read

Optimistic concurrency in EF Core: stop silent overwrites

Two users edit the same row and the last save silently wins. Use EF Core concurrency tokens, inspect the generated UPDATE, handle DbUpdateConcurrencyException, and test the race with two DbContexts.

Read article →
7 min read

Connection pooling: why your app ran out of connections

Connection pooling explained from the failure end: what a connection costs, the three ways pools drain, and why the timeout blames the wrong request.

Read article →
8 min read

How do database indexes work? B-trees, page by page

How do database indexes work? A B-tree is a small sorted structure with huge fanout, so a lookup reads a handful of pages instead of the whole table.

Read article →
7 min read

Skip and Take will betray you: offset vs keyset pagination

OFFSET pagination reads every row it skips, so page 2,000 costs 2,000 pages of work. Keyset pagination seeks straight to the next page. The SQL, the EF Core, the trade-offs.

Read article →
7 min read

EF Core habits that quietly wreck performance

Nine EF Core habits that pass every test and quietly tank performance in production: missing AsNoTracking, fetching whole entities, N+1, cartesian explosion, counting in memory, and more.

Read article →
6 min read

Your LINQ is fast; your query plan isn't

A perfectly written EF Core query can still do a sequential scan: no index, or a function on a column makes it non-sargable. How to read a query plan and fix it.

Read article →
6 min read

IQueryable vs IEnumerable: the one return type that decides where your query runs

Returning IEnumerable, or calling ToList too early, moves filtering and paging into C# memory. How one type change turns an indexed WHERE into loading a million rows.

Read article →
6 min read

The N+1 query problem in EF Core: the most expensive habit in .NET

An EF Core loop that looks innocent fires one query per row. It passes every unit test and dies in production. How N+1 happens, the SQL it generates, and the fix.

Read article →

Get new puzzles and .NET tips in your inbox

A short note when fresh kata land, plus the C# and performance tricks behind the grading. No spam, unsubscribe anytime.