postgresql-query-optimization

Community

Tune slow PostgreSQL queries.

Authorrudi-bruchez
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill addresses slow-running PostgreSQL queries by providing a systematic approach to identify, diagnose, and resolve performance bottlenecks.

Core Features & Use Cases

  • Identify Slow Queries: Uses pg_stat_statements and pg_stat_activity to pinpoint expensive queries.
  • Analyze Execution Plans: Leverages EXPLAIN ANALYZE to understand query execution flow and identify costly operations.
  • Index Optimization: Recommends and creates appropriate B-tree, GIN, GiST, or BRIN indexes, including partial and covering indexes.
  • Statistics Tuning: Guides on updating table statistics and setting extended statistics for correlated columns.
  • Configuration Adjustments: Provides recommendations for key PostgreSQL parameters like random_page_cost, work_mem, and effective_cache_size.
  • Use Case: An application is experiencing slow response times. This Skill can analyze the database activity, identify the top offending queries, explain their execution plans, and suggest specific index creations or configuration changes to improve performance.

Quick Start

Use the postgresql-query-optimization skill to analyze and optimize the slow query SELECT * FROM orders WHERE customer_id = 123;.

Dependency Matrix

Required Modules

None required

Components

scriptsreferencesassets

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: postgresql-query-optimization
Download link: https://github.com/rudi-bruchez/dba-skills/archive/main.zip#postgresql-query-optimization

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.