database-performance

Diagnose and resolve database performance issues in .NET applications.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/MudraMartin/dotlight-skillset --skill database-performance-mudramartin
Or copy as Structured Prompt for Agentā–¼
Please help me install this Agent Skill.
Skill: database-performance
Source: https://github.com/MudraMartin/dotlight-skillset/tree/main/dotnet/database-performance
Command: npx skills add https://github.com/MudraMartin/dotlight-skillset --skill database-performance-mudramartin

SYSTEM DOCUMENTATION & REQUIREMENTS

šŸ’” This Skill requires EF Core, NHibernate, Dapper, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses common database performance issues and helps .NET developers design and diagnose efficient data access layers.

Core Features & Use Cases

  • Read/Write Model Separation: Ensures data models for reads and writes are distinct, optimizing query performance.
  • Batch Processing: Reduces the N+1 query problem by processing data in batches.
  • AsNoTracking: Optimizes EF Core queries by avoiding change tracking on read-only data.
  • SQL Joins: Ensures joins are performed at the database level rather than in application code.
  • Avoiding Cartesian Products: Provides strategies to prevent over-fetching data that leads to performance bottlenecks.
  • Column Size Constraints: Enforces maximum lengths for column data to prevent database corruption.
  • Avoid Generic Repositories: Promotes the use of purpose-built repositories for better performance and maintainability.
  • EF Core vs Dapper Usage: Offers guidance on when to use EF Core and Dapper for different scenarios.

Quick Start

Use the 'database-performance' skill to optimize a query for your EF Core model.

Frequently Asked Questions about database-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix N+1 query problems in EF Core?ā–¼

EF Core handles N+1 queries by enforcing batch processing and ensuring SQL joins execute at the database level. This Skill identifies inefficient data retrieval patterns and provides architectural guidelines to resolve them.

When should I use Dapper instead of EF Core for database performance?ā–¼

Use Dapper instead of EF Core when you need optimized read-only queries, utilizing AsNoTracking to avoid change tracking overhead. This Skill offers guidance on when to apply Dapper versus EF Core for different data access scenarios.

What is the best way to separate read and write models in .NET data access?ā–¼

The best way to separate read and write models is implementing CQRS principles to ensure distinct data models for reads and writes. This Skill provides architectural guidelines for optimizing query performance through data access design patterns.

Why should I avoid generic repositories with NHibernate or EF Core?ā–¼

Avoid generic repositories with NHibernate or EF Core to ensure purpose-built data access patterns that prevent over-fetching and Cartesian products. This Skill promotes tailored repositories for better performance and maintainability.

Does AsNoTracking improve EF Core query performance for read-only data?ā–¼

AsNoTracking improves EF Core query performance by bypassing change tracking on read-only data, reducing memory overhead. This Skill provides guidelines to apply this optimization alongside column size constraints to prevent database corruption.