.NET Development

EF Core 9 Performance: AsNoTracking, Split Queries & Compiled Queries

Abid Inamdar December 25, 2025 6 min read 199 views

Why EF Core Performance Matters

ORM overhead is real. These three techniques address the most common bottlenecks in enterprise .NET apps.

Database performance dashboard
Database performance dashboard

1. AsNoTracking

var posts = await db.BlogPosts
    .AsNoTracking()
    .Where(p => p.Status == PostStatus.Published)
    .ToListAsync();
âš¡

AsNoTracking alone gives 30–50% speedup on read-only queries by skipping the change tracker.

2. Split Queries

var posts = await db.BlogPosts
    .Include(p => p.Tags)
    .Include(p => p.Comments)
    .AsSplitQuery()
    .ToListAsync();

3. Compiled Queries

private static readonly Func<BlogDbContext, string, Task<BlogPost?>> GetBySlug =
    EF.CompileAsyncQuery((BlogDbContext db, string slug) =>
        db.BlogPosts.FirstOrDefault(p => p.Slug == slug));

Conclusion

Profile first with dotnet-trace, then apply these techniques where they matter most.

Share: Twitter/X LinkedIn

Related Posts

Comments (0)

Leave a Comment
Comments are moderated.