Pro EP 33 : 15+ Tips to Improve Entity Framework Core Performance
💡15+ Steps To Improve EF Core Performance
1. Use projections
2. Use Async Methods
3. Use compiled queries in EF
4. Avoid non cancellable queries
5. Include only necessary tables
6. Select desired rows ( obviously)
7. For bulk processing use chunks
8. Use Any method of LINQ for filters
9. Use DbContextPool with db contexts
10. For multiple filters use IQueryable
11. Don’t use raw SQL queries everywhere
12. Use AsNoTracking for readonly operations
13.Use Pagination, don’t bring all data once
14. Use TryGetNonEnuneratedCount for Count
15. Avoid using SQL Queries in for each loop.
16. Reduce round trips to database by calling SaveChangesAsync one time for bulk operations.
If you want to help the author in growing
- Subscribe my Weekly .NET Newsletter of C#/.NET with 900+ Software Engineers.
- Become Patron to get access to 90+ Compiled Questions and Answers at one place.
- Download my eBook at Gum road that contains 30+ .NET Tips.