postgres-pro

Guide PostgreSQL EXPLAIN analysis, indexing, replication, and maintenance workflows.

10.9k|1.0k|Updated Oct 20, 2025
One-click install
npx skills add https://github.com/Jeffallan/claude-skills --skill postgres-pro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-pro
Source: https://github.com/Jeffallan/claude-skills/tree/main/skills/postgres-pro
Command: npx skills add https://github.com/Jeffallan/claude-skills --skill postgres-pro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill guides query optimization, replication, and JSONB usage across PostgreSQL deployments.

Core Features & Use Cases

  • Query optimization: EXPLAIN ANALYZE and plan tuning.
  • Replication & maintenance: Streaming/Logical replication and VACUUM/ANALYZE.
  • JSONB: Indexing and containment patterns.

Quick Start

Run EXPLAIN ANALYZE on a slow query and propose an index strategy.

Frequently Asked Questions about postgres-pro

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

FAQPage Schema
How do I use EXPLAIN ANALYZE to find and fix slow PostgreSQL queries?

EXPLAIN ANALYZE shows the query plan and actual execution metrics—row counts, timing, and node costs. Run it on a slow query to identify bottlenecks like sequential scans or missing indexes, then propose indexing strategies or query rewrites to reduce execution time.

What indexing strategies work best for PostgreSQL performance?

PostgreSQL supports B-tree, GIN, GiST, and BRIN indexes for different workloads. B-tree handles most queries; GIN accelerates JSONB and full-text search; GiST suits geometric data; BRIN covers large sorted datasets. Choose based on query patterns and data type.

How do I optimize JSONB queries and indexing in PostgreSQL?

Index JSONB columns with GIN indexes to speed up containment and key searches. Use containment operators (@>) and key lookups to leverage indexes. JSONB offers faster performance than text JSON for large documents.

When should I use replication in PostgreSQL and how do I configure it?

Streaming replication creates real-time standby replicas for failover and read scaling; logical replication replicates specific tables to other databases. Choose streaming for high availability; logical for selective replication across versions or heterogeneous environments.

How do VACUUM and ANALYZE improve PostgreSQL performance and health?

VACUUM reclaims dead rows and prevents bloat; ANALYZE updates statistics for the query planner. Run VACUUM regularly on write-heavy tables and ANALYZE after bulk operations to keep the optimizer informed and queries fast.

What does pg_stat_statements reveal about PostgreSQL query performance?

pg_stat_statements tracks query execution statistics—total time, call count, rows returned—across your database. Monitor it to identify slow or frequently-called queries, then apply optimization strategies like indexing or query rewrites.