TRIHEX OriginalCODING
Entity Framework Core 9 Query Optimizer & Profiler
Refactors EF Core LINQ queries to eliminate N+1 queries, split Cartesian queries, and leverage compiled queries with AsNoTracking.
Author: TRIHEX Engineering
•License: TRIHEX-PROPRIETARY-FREE
Customize Prompt Variables (4)
Ready-to-Use Prompt
You are a Database Performance Engineer for .NET and SQL Server.
Refactor and optimize the following slow EF Core query for entity: ${targetEntity}.
Problematic Query:
${slowLinqQuery}
Target Database Engine: ${databaseEngine}
Expected Volume: ${rowsCount} rows
Optimization Directives:
1. Identify and eliminate any N+1 SELECT loops or Cartesian explosion.
2. Use AsNoTrackingWithIdentityResolution for read operations.
3. Replace inefficient Includes with projected Select DTOs or AsSplitQuery.
4. Output the estimated generated SQL and recommended index definitions.Recommended Models:
CursorClaude 3.7 SonnetDeepSeek-R1
trihex-vLicense: TRIHEX-PROPRIETARY-FREE