query-optimization

Analyze SQL execution plans and implement indexing strategies to optimize query performance.

8|2|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/bradtaylorsf/alphaagent-team --skill query-optimization-bradtaylorsf
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: query-optimization
Source: https://github.com/bradtaylorsf/alphaagent-team/tree/main/plugins/aai-dev-database/skills/query-optimization
Command: npx skills add https://github.com/bradtaylorsf/alphaagent-team --skill query-optimization-bradtaylorsf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses slow database query performance by providing patterns and strategies to optimize query execution, reduce load, and improve application responsiveness.

Core Features & Use Cases

  • Query Plan Analysis: Understand EXPLAIN ANALYZE output and query execution plans.
  • Indexing Strategies: Learn when and how to create effective single-column, composite, partial, and covering indexes.
  • Query Patterns: Avoid common pitfalls like N+1 queries and implement efficient pagination and selective field loading.
  • Bulk Operations: Utilize batch inserts and updates for better performance.
  • Caching: Implement query result caching and understand materialized views.
  • Monitoring: Set up slow query logging and connection pooling.

Quick Start

Analyze the query plan for the provided SQL statement to identify performance bottlenecks.

Frequently Asked Questions about query-optimization

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

FAQPage Schema
How do I optimize slow PostgreSQL query performance using execution plans?

To optimize slow PostgreSQL query performance, analyze the `EXPLAIN ANALYZE` output to identify bottlenecks, then apply indexing strategies and query rewriting to reduce data retrieval time and database load.

What's the best way to create database indexes for query optimization?

The best way to create database indexes for query optimization involves implementing single-column, composite, partial, and covering indexes based on your specific data access patterns to improve read/write speeds.

How do I fix N+1 query problems and inefficient pagination in SQL?

Fix N+1 query problems and inefficient pagination in SQL by rewriting query patterns to implement selective field loading, batch operations, and proper join logic to minimize redundant database requests.

When do I need materialized views and query result caching for database performance tuning?

You need materialized views and query result caching for database performance tuning when addressing high database load, allowing you to store precomputed results and reduce repetitive resource consumption.

Does query optimization work for reducing high database load from bulk operations?

Query optimization works for reducing high database load from bulk operations by utilizing batch inserts and updates, alongside connection pooling and slow query logging, to improve overall application responsiveness.

Why does database query performance degrade and how can indexing help?

Database query performance degrades due to inefficient data access patterns and missing indexes, which indexing helps resolve by allowing the database engine to locate records without full table scans.