EF Core Performance Optimization Challenge | 233x FASTER

preview_player
Показать описание

In this video, I'm going to be solving an EF Core performance optimization challenge. The goal is to optimize a poorly performing EF Core query and make it as fast as possible. My friend Stefan created the challenge, and there's still time to post your submission. How fast can you make this EF Core query?

You can find Stefan's EF Core performance challenge here:

Stefan's LinkedIn (follow him for great C# posts)

Join my weekly .NET newsletter:

Subscribe for more:

Chapters
0:00 What is the challenge?
1:55 Improvement 1: Upgrade .NET version
2:10 Improvement 2: Don't load the entire Authors table
3:31 Improvement 3: Limit the number of Authors returned
4:46 Improvement 3: Filter the Books
6:11 Improvement 4: Fetch only required columns
7:48 AsNoTracking discussion
9:14 Improvement 5: Sorting before projection
10:08 Improvement 6: Filtered Include
12:02 Improvement 7: Query Splitting
13:12 Improvement 8: Get lucky
Рекомендации по теме
Комментарии
Автор

Hey MIlan. Thank you for solving my EF Core performance optimization challenge. You did a great job and explained it even better in the video. 😃

thecodeman_
Автор

Just a small note to everyone, may be it is obvious for most but always use the Async overload as much as possible (at least for all microsoft frameworks and libraries, for 3rd parts, it depends) => async/await end-to-end
It may not improve the performance (depend on a lot of things) but it is much better to manage the connections and anything cpu related

anthonylerouge
Автор

Awesome video. The way you explained is very clear and feel like everyone was waiting eagerly for climax.

DotnetDummies
Автор

You nailed it Milan, I love how your explanation with benchmark. Im sure ppl out there will get benefit of that

prasadmadushan
Автор

This is an amazing video. I loved the way you went about deciphering each layer of the query and combining the changes with the benchmark results. Thanks for sharing such valuable insights 👍

nilesh-gule
Автор

Can you explain please 6 stet: Filtered Include? I don't understand why it faster?

Javilingys
Автор

I've been following you on LinkedIn for a while and happy to see you making such videos. This was fun. Keep rocking!

ardavaztterterian
Автор

Great video, more challenges like this would really help

leulgirma
Автор

Thanks you for all. I take much pleasure to learn new thing from you.

kodindoyannick
Автор

Excellent video. I did not know about include statements with filters and the significant performance improvement

philmontewelde
Автор

Really good explanation!!, it's pretty common to find this kind of issues when working on legacy code, and just by making this small changes you get a boost of performance that will be noticed by the users. Sometimes is more complex, other not so much, but is always a good place to start.

marinero.bengali
Автор

Dolazim iz istog svijeta kao i ti Milane :) Kad mi je ovaj video iskocio i kad sam pogledao na prvu "neoptimiziran" query, iskreno sam se zapitao koja je j***na budala napisala ovako los LINQ upit :) Ali valjda je namjerno to napravljeno kako bi se pokazalo da je cesto lako ubrzati query i to na nacin da se reorganizira malo query.

TheMiamiVice
Автор

Love your videos. One of the patterns I've used very commonly when dealing with returning complex datasets is actually pulling the root objects from the database first, in this case Authors. And then doing a follow-up query to pull additional metadata based on the filtered Authors.

For instance, I have a search api that returns products and child products (there's only 2 tiers) but there are 50, 000 products to search. It's a paginated list so I pre-filter the parent products and execute the statement. Then I execute a child query specifically for the returned results.

It's not always a performance boost, but I find on very large datasets with a lot of metadata properties that need to come from the database, it can be faster to pull and then combine in memory.

recycledsoldier
Автор

wow you have got such a great ability to explain things very clearly !!! subscribed 👍

rakeshkrishnan
Автор

Love the video, hearing you think it through reinforces my understanding of building queries

jamestheloyalkingsfan
Автор

Great video and explanations! Well done!

kjbetz
Автор

Awesome tutorial with a lot of useful efcore information. Thanks a lot!

stephenraphael
Автор

I am a .NET developer, I like your concept. It is helpful really great job

SandeepKumar-tcvz
Автор

Faced a similar issue when we tested on prod db. We had an SLA of 2 seconds but the query was taking more than 1 minute. We had to migrate to Stored Procedure and use multiple temp tables to reach the SLA.

tasin
Автор

This is a very good post and video. Subscribed right now. Thanks. More videos please.

wonpaper