~/talk

Common mistakes in EF Core

Talkat NDC London 2024 · 2024-01-29..02-02· [databases]

Concrete failures and fixes with numbers: casting queries to IEnumerable loads 7 million rows into RAM (one run used ~30 GB and made the laptop unresponsive for 15 minutes), while keeping it as IQueryable lets SQL return COUNT() in ~130 ms (vs seconds) and avoids huge memory. Using AsNoTracking cuts allocations ~4x–5x and speeds queries, proper Skip/Take plus server-side Query.Count is ~18x faster for paging, cancellation token* stops SQL work and recovers throughput. Tests run with benchmark.us bombia on a Ryzen 9 5900X.

AI-written summary · about

  1. 0:00Introduction
  2. 3:19Why EF Core is great
  3. 15:39Seven deadly sins
  4. 17:05Mistake 1: IEnumerable vs IQueryable
  5. 24:17Mistake 2: Disabling AsNoTracking
  6. 28:59Mistake 3: Overusing includes
  7. 32:12Mistake 4: Ignoring pagination
  8. 36:52Mistake five: Not using cancellation tokens
  9. 40:51Mistake 6: Inefficient updates
  10. 43:48Advanced optimizations
  11. 53:30When to optimize
  12. 58:30Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.