database-performance

Diagnose and optimize PostgreSQL or MySQL database performance with EXPLAIN ANALYZE and indexing.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/marquesfelip/agents-and-skills --skill database-performance-marquesfelip
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-performance
Source: https://github.com/marquesfelip/agents-and-skills/tree/main/skills/database-performance
Command: npx skills add https://github.com/marquesfelip/agents-and-skills --skill database-performance-marquesfelip

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Database performance optimization for SQL workloads by guiding query tuning, indexing strategies, and configuration adjustments to reduce latency and improve throughput.

Core Features & Use Cases

  • Diagnosis and tuning of slow queries using EXPLAIN ANALYZE and query profiling.
  • Index design including composite, partial, and covering indexes, plus autovacuum tuning and vacuum maintenance.
  • Connection pooling configuration and bottleneck mitigation to prevent saturation and reduce request queuing.
  • N+1 query elimination through joins and batch loading; use of materialized views for expensive aggregations.

Quick Start

Run an EXPLAIN ANALYZE on a representative slow query and apply the recommended indexing strategy to see immediate improvements.

Frequently Asked Questions about database-performance

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

FAQPage Schema
How do I diagnose slow database queries using EXPLAIN ANALYZE?

Database query tuning requires collecting EXPLAIN ANALYZE outputs or slow query logs to identify execution bottlenecks. You can then design appropriate indexes, including composite and partial indexes, to reduce latency and improve throughput for your specific workload.

How do I fix N+1 query issues in my database?

N+1 query elimination is achieved by guiding query restructuring through joins and batch loading. This approach replaces repetitive single-row fetches with optimized bulk operations, significantly reducing round trips and improving overall application responsiveness.

What is the best way to configure connection pooling to prevent request saturation?

Connection pooling configuration mitigates bottlenecks by tuning pool sizes to prevent saturation and reduce request queuing. Properly configured pools manage concurrent connections efficiently, minimizing overhead and improving throughput across OLTP and reporting workloads.

Does this database tuning approach work for both PostgreSQL and MySQL?

Yes, this database performance optimization covers PostgreSQL, MySQL, or similar engines. It addresses engine-specific needs like autovacuum tuning and VACUUM maintenance for PostgreSQL, while general indexing and pooling strategies apply across supported platforms.

When should I use materialized views for expensive database aggregations?

Materialized views are recommended for expensive aggregations in reporting use cases where real-time computation is too costly. They precompute and store complex query results, trading slight data staleness for significantly improved read performance and reduced locking contention.

How do I reduce table bloat and locking issues in a high traffic database?

Table bloat and locking issues are reduced by tuning autovacuum, performing VACUUM maintenance, and optimizing transaction queries. These actions reclaim dead space and minimize lock contention, ensuring sustained performance for high concurrency OLTP environments.