database-performance

Optimize database access patterns with EF Core and Dapper.

Updated Feb 15, 2026
One-click install
npx skills add https://github.com/Buggz/Thuddle --skill database-performance-buggz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-performance
Source: https://github.com/Buggz/Thuddle/tree/main/.claude/skills/database-performance
Command: npx skills add https://github.com/Buggz/Thuddle --skill database-performance-buggz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses common performance bottlenecks in database interactions, ensuring efficient data retrieval and manipulation for applications.

Core Features & Use Cases

  • Read/Write Separation: Implements CQRS patterns for distinct read and write data models.
  • Query Optimization: Provides strategies to avoid N+1 queries, Cartesian explosions, and application-side joins.
  • Resource Management: Guides on using AsNoTracking for read queries and applying row limits.
  • Tooling: Offers insights on when to use EF Core versus Dapper for different workloads.
  • Use Case: Optimize a slow-loading e-commerce product page by ensuring only necessary data is fetched and joins are performed efficiently in SQL.

Quick Start

Use the database-performance skill to learn about optimizing read queries with EF Core.

Frequently Asked Questions about database-performance

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

FAQPage Schema
How do I avoid N+1 queries and Cartesian explosions in EF Core?

To avoid N+1 queries and Cartesian explosions in EF Core, you should perform joins in SQL and use `AsSplitQuery` for related data, ensuring efficient database access patterns by fetching necessary data without creating excessive round trips.

What is the best way to optimize database read queries for slow-loading pages?

The best way to optimize database read queries is by enforcing read/write model separation using CQRS, applying row limits, and using `AsNoTracking` for read-only operations to fetch only necessary data efficiently.

When should I use Dapper instead of EF Core for database operations?

You should use Dapper instead of EF Core for complex read operations where performance is critical. EF Core is suitable for general data manipulation, but Dapper provides better performance for specialized, complex read queries.

Does using AsNoTracking really improve EF Core read performance?

Yes, using `AsNoTracking` improves EF Core read performance by bypassing the change tracker. This reduces memory overhead and processing time for read-only queries, making database access patterns more efficient.

Why are application-side joins considered an anti-pattern for database optimization?

Application-side joins are an anti-pattern because they fetch unjoined data across multiple queries and merge it in memory. Performing joins directly in SQL is faster, reduces network traffic, and leverages the database's query optimization engine.

How do I implement CQRS patterns for read and write data models?

To implement CQRS patterns, you separate your read and write data models completely. This allows you to optimize read queries for specific views using `AsNoTracking` and Dapper, while using EF Core for transactional write operations.