database-performance

Optimize database access patterns with CQRS, AsNoTracking, row limits, and SQL joins for EF Core and Dapper.

1|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/bbsbot/mac-md-win --skill database-performance-bbsbot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-performance
Source: https://github.com/bbsbot/mac-md-win/tree/main/.claude/skills/dotnet/skills/database-performance
Command: npx skills add https://github.com/bbsbot/mac-md-win --skill database-performance-bbsbot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses common performance bottlenecks in database interactions, helping developers write more efficient and scalable data access layers.

Core Features & Use Cases

  • CQRS Pattern: Implement read/write model separation for optimized queries.
  • Query Optimization: Avoid N+1 queries, use AsNoTracking, apply row limits, and perform joins in SQL.
  • Use Case: When experiencing slow load times in an application due to inefficient database queries, this Skill provides patterns to refactor the data access layer for significant performance gains.

Quick Start

Use the database-performance skill to learn about implementing read/write model separation.

Frequently Asked Questions about database-performance

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

FAQPage Schema
How do I optimize database queries to fix slow application load times?

To optimize database queries and resolve slow load times, you should refactor your data access layer by avoiding N+1 queries, applying row limits, using AsNoTracking, and performing joins directly in SQL.

What is the CQRS pattern and how does it improve database performance?

The CQRS pattern improves database performance by separating read and write models, allowing you to optimize query structures specifically for data retrieval or persistence rather than using a single model for both.

How do I avoid N+1 query problems in EF Core and Dapper?

To avoid N+1 query problems in EF Core and Dapper, you should perform joins in SQL to retrieve related data in a single round trip instead of issuing separate queries for each entity relationship.

When should I use AsNoTracking for database access pattern optimization?

You should use AsNoTracking for database access pattern optimization when executing read-only queries, as it prevents the framework from tracking entity state and reduces memory overhead for improved performance.

Does this database optimization guidance work with both EF Core and Dapper?

Yes, this database optimization guidance works with both EF Core and Dapper, providing specific strategies like performing SQL joins and applying row limits to address performance pitfalls across both data access technologies.

What are the limitations of using CQRS for data access layer refactoring?

Implementing CQRS for data access layer refactoring introduces complexity by requiring separate models for reads and writes, which is best suited for scenarios experiencing significant performance bottlenecks rather than simple CRUD operations.