database-performance

Optimizes database access patterns with CQRS, EF Core and Dapper best practices for scalability.

57|7|Updated Aug 6, 2025
One-click install
npx skills add https://github.com/seiggy/lucia-dotnet --skill database-performance-seiggy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-performance
Source: https://github.com/seiggy/lucia-dotnet/tree/main/.github/skills/database-performance
Command: npx skills add https://github.com/seiggy/lucia-dotnet --skill database-performance-seiggy

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

  • Read/Write Separation: Implements CQRS principles for distinct read and write models.
  • Query Optimization: Enforces row limits, avoids N+1 queries, and promotes SQL joins.
  • EF Core & Dapper Guidance: Provides best practices for both ORMs, including AsNoTracking and explicit projections.
  • Use Case: When experiencing slow query times in an application, consult this Skill to identify and rectify issues like fetching unnecessary data or performing inefficient joins.

Quick Start

Use the database-performance skill to understand how to avoid N+1 queries when fetching orders and their items.

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 when fetching related data?

To avoid N+1 queries, use SQL joins or explicit projections to fetch related data in a single trip. This query optimization prevents unnecessary database roundtrips and reduces latency.

What is the best way to separate read and write models for database scalability?

Implementing CQRS principles is the best way to separate read and write models for database scalability. This creates distinct models tailored for specific operations, improving overall performance and scalability.

How do I optimize EF Core to prevent Cartesian explosions?

Optimize EF Core to prevent Cartesian explosions by using explicit projections and applying row limits. Additionally, use AsNoTracking for read-only queries to reduce overhead and improve performance.

Does Dapper support query optimization techniques like row limits?

Yes, Dapper supports query optimization techniques like row limits and avoiding N+1 queries. The Skill provides specific best practices for writing efficient and scalable data access layers using Dapper.

Why does my application experience slow database query times?

Slow database query times often occur from fetching unnecessary data or performing inefficient joins. Consult this Skill to identify issues like N+1 queries or Cartesian explosions and rectify access patterns.