How AsNoTracking() impact on performance ?
Shubham Sidnale
Select an image from your device to upload
In Entity Framework (EF) Core,AsNoTracking() tells the DbContext not to track the entities returned by a query. By default, EF tracks all retrieved objects to automatically detect and save modifications.
AsNoTracking()
DbContext
AsNoTracking() improves performance by 35–40% and reduces memory usage by 50% because it stops the DbContext from snapshotting data or monitoring property changes.
Simple example:
// Use for fast, read-only data (API/Reports) var list = context.Products.AsNoTracking().ToList();// Skip for updates (requires tracking) var item = context.Products.First(); item.Price = 10; context.SaveChanges();
Hope this helps you understand.