database-query-optimization

Analyze EXPLAIN ANALYZE outputs to identify and optimize slow database queries.

Updated Dec 28, 2025
One-click install
npx skills add https://github.com/Khrees2412/grepbase --skill database-query-optimization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-query-optimization
Source: https://github.com/Khrees2412/grepbase/tree/main/.agents/skills/database-query-optimization
Command: npx skills add https://github.com/Khrees2412/grepbase --skill database-query-optimization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Slow database queries can degrade application performance and user experience. This skill helps identify bottlenecks, design effective indexing strategies, and optimize execution plans.

Core Features & Use Cases

  • Query performance analysis with EXPLAIN ANALYZE outputs to determine whether scans, joins, or sorts are causing delays.
  • Indexing guidance, including single-column, composite, covering, and partial indexes, tailored to workload patterns.
  • Practical patterns to replace N+1 queries, optimize data access, and validate improvements with measurable metrics.

Quick Start

Run a quick audit on a representative workload to identify the top slow queries and propose index plans.

Frequently Asked Questions about database-query-optimization

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

FAQPage Schema
How do I optimize slow SQL queries using execution plans?

To optimize slow SQL queries, you analyze EXPLAIN ANALYZE outputs to identify delays caused by scans, joins, or sorts, then apply query-tuning techniques and design appropriate indexes to improve execution plans.

What is the best way to design database indexes for high CPU load?

Designing database indexes for high CPU load involves creating single, composite, covering, or partial indexes tailored to your specific workload patterns to reduce query response times and alleviate database stress.

How do I fix N+1 queries causing performance regressions?

To fix N+1 queries causing performance regressions, you replace inefficient data access patterns with optimized query structures and validate the improvements using measurable performance metrics.

Can I use covering and partial indexes to speed up SQL queries?

Yes, you can use covering and partial indexes to speed up SQL queries by tailoring indexing strategies to specific workload patterns, which minimizes data scanning and improves overall execution plan efficiency.

What are the limitations of indexing for database optimization?

Indexing for database optimization requires understanding EXPLAIN ANALYZE outputs and workload patterns; without proper validation and monitoring, inappropriate single or composite indexes may not resolve long response times or high CPU load.