postgresql-optimization

Analyze PostgreSQL queries with EXPLAIN ANALYZE and tune indexes and configuration.

10|3|Updated Mar 14, 2025
One-click install
npx skills add https://github.com/Mentor-Wizard/mentor-wizard-webapp --skill postgresql-optimization-mentor-wizard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-optimization
Source: https://github.com/Mentor-Wizard/mentor-wizard-webapp/tree/main/.claude/skills/postgresql-optimization
Command: npx skills add https://github.com/Mentor-Wizard/mentor-wizard-webapp --skill postgresql-optimization-mentor-wizard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of slow database performance in PostgreSQL by providing a structured workflow for identifying and resolving bottlenecks through query tuning, indexing, and configuration adjustments.

Core Features & Use Cases

  • Query Performance Analysis: Utilizes EXPLAIN ANALYZE to diagnose slow queries and identify inefficient execution plans.
  • Indexing Strategies: Guides the creation and optimization of B-tree, composite, and partial indexes.
  • Configuration Tuning: Provides recommendations for key PostgreSQL parameters like shared_buffers, work_mem, and autovacuum.
  • Maintenance & Monitoring: Establishes routines for VACUUM, ANALYZE, and performance monitoring.
  • Use Case: A web application experiences slow page load times due to database queries. This Skill can be used to pinpoint the exact queries causing the slowdown, suggest appropriate indexes, and tune the PostgreSQL configuration to improve response times.

Quick Start

Use the postgresql-optimization skill to analyze slow queries and suggest indexing strategies for the production database.

Frequently Asked Questions about postgresql-optimization

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

FAQPage Schema
How do I identify bottlenecks in slow PostgreSQL queries?

PostgreSQL query tuning involves diagnosing slow queries using `EXPLAIN ANALYZE` to identify inefficient execution plans. It helps optimize database response times by revealing how queries interact with indexes and configurations.

What is the best way to optimize PostgreSQL indexing strategies?

The best way to optimize PostgreSQL indexing is by creating and fine-tuning B-tree, composite, and partial indexes. Proper indexing strategies directly resolve slow page load times by enabling faster data retrieval without full table scans.

How do I tune PostgreSQL configuration parameters for better performance?

Tuning PostgreSQL configuration involves adjusting key parameters like `shared_buffers`, `work_mem`, and `autovacuum` settings. These configuration adjustments fine-tune the database environment for enhanced efficiency and stability under production workloads.

When do I need to run VACUUM and ANALYZE for PostgreSQL maintenance?

You need to run `VACUUM` and `ANALYZE` routines as part of regular PostgreSQL maintenance and monitoring. These routines manage database bloat and update statistics, which are essential for maintaining query performance over time.

Does this approach work for optimizing a production database administration workflow?

Yes, this approach supports production database administration by establishing performance monitoring and fine-tuning configurations. It facilitates bottleneck identification and query execution plan optimization specifically within active production environments.