database-optimization

Analyze PostgreSQL and MySQL queries with EXPLAIN ANALYZE and design indexing strategies.

2.5k|877|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/rohitg00/awesome-claude-code-toolkit --skill database-optimization-rohitg00
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-optimization
Source: https://github.com/rohitg00/awesome-claude-code-toolkit/tree/main/skills/database-optimization
Command: npx skills add https://github.com/rohitg00/awesome-claude-code-toolkit --skill database-optimization-rohitg00

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Slow database queries and poorly chosen indexes hinder application performance. This skill teaches how to analyze queries, design effective indexes, and tune PostgreSQL and MySQL for faster, more reliable workloads.

Core Features & Use Cases

  • Query analysis with EXPLAIN: interpret query plans to identify bottlenecks.
  • Indexing strategies: B-tree, partial, GiST, GIN, and covering indexes, plus when to use each.
  • Performance tuning: configuration adjustments, partitioning strategies, and read replica considerations.
  • Real-world scenarios: optimize a batch reporting workload or an OLTP workload with transactional latency.

Quick Start

Run EXPLAIN ANALYZE on a representative query and implement the recommended indexing and partitioning changes.

Frequently Asked Questions about database-optimization

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

FAQPage Schema
How do I analyze slow PostgreSQL or MySQL queries to find performance bottlenecks?

Analyze slow queries by running EXPLAIN ANALYZE to interpret query plans and identify bottlenecks. This skill teaches you how to read execution plans, detect inefficiencies like N+1 issues, and pinpoint where latency originates in your database workloads.

What is the difference between partial, GiST, and covering indexes for database optimization?

Covering indexes include all columns needed by a query, partial indexes filter specific rows, and GiST indexes support geometric data. This skill explains when to use each index type to ensure faster queries and reduced latency in PostgreSQL and MySQL.

How do I reduce transactional latency in an OLTP database workload?

Reduce OLTP latency by implementing proper indexing strategies, detecting N+1 query issues, and adjusting database configurations. This skill provides targeted performance tuning techniques to speed up transactional workloads in PostgreSQL and MySQL environments.

Can I use partitioning and read replicas to improve batch reporting workload performance?

Yes, partitioning and read replicas improve batch reporting workloads by distributing read operations and segmenting large tables. This skill covers partitioning strategies and read replica considerations to optimize heavy analytical and OLAP workloads.

What's the best way to detect and fix N+1 query problems in PostgreSQL?

The best way to fix N+1 query problems is by analyzing query plans with EXPLAIN ANALYZE and applying proper indexing strategies. This skill teaches you to identify repetitive query patterns and optimize them for faster database performance.

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

Yes, this optimization approach works for both PostgreSQL and MySQL. It covers query analysis, indexing strategies like B-tree and covering indexes, and performance tuning techniques applicable to both platforms for OLTP and OLAP workloads.