postgresql-troubleshooting-sql

Run SQL scripts to diagnose PostgreSQL health, replication, storage, and query performance.

1|3|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/IldarMinaev/troubleshooting-skill --skill postgresql-troubleshooting-sql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-troubleshooting-sql
Source: https://github.com/IldarMinaev/troubleshooting-skill/tree/main/skills/_sql
Command: npx skills add https://github.com/IldarMinaev/troubleshooting-skill --skill postgresql-troubleshooting-sql

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This collection provides a comprehensive suite of PostgreSQL diagnostic SQL scripts that surface health, performance, replication, storage, connections, locks, and configuration insights, enabling rapid troubleshooting.

Core Features & Use Cases

  • Health checks for connections, replication lag, dead tuples, vacuum health, and WAL status.
  • Performance analysis including slow queries, cache hits, table I/O, and index usage.
  • Comprehensive coverage of replication, storage, and locking scenarios for Kubernetes deployments and on-prem clusters.

Quick Start

Execute the desired SQL script against your PostgreSQL instance using psql stdin to obtain immediate diagnostic results.

Frequently Asked Questions about postgresql-troubleshooting-sql

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

FAQPage Schema
How do I run PostgreSQL health checks to diagnose replication lag and storage usage?

PostgreSQL health checks are executed by running a curated suite of diagnostic SQL scripts against your target cluster to identify and quantify issues like replication lag, storage usage, and query performance. You can apply these scripts to both standalone and Kubernetes-hosted deployments.

What SQL queries can I use to troubleshoot slow queries and locking issues in PostgreSQL?

To troubleshoot slow queries and locking issues in PostgreSQL, you can use curated diagnostic SQL scripts that analyze query performance, cache hits, table I/O, index usage, and locking scenarios. These scripts provide immediate diagnostic results when executed via psql.

Does this PostgreSQL troubleshooting SQL suite work with Kubernetes deployments?

Yes, this SQL suite works with Kubernetes-hosted PostgreSQL deployments. It provides comprehensive coverage of replication, storage, and locking scenarios specifically for Kubernetes environments, alongside compatibility with standalone on-premises clusters.

Do I need pg_stat_statements to monitor PostgreSQL performance with these SQL scripts?

Yes, pg_stat_statements is utilized by these PostgreSQL performance monitoring SQL scripts to ensure robust query performance tracking. The diagnostic suite includes queries compatible with PostgreSQL versions 14 through 17.

How do I check for dead tuples and vacuum health in PostgreSQL using SQL?

You can check for dead tuples and vacuum health in PostgreSQL by executing the included health check SQL scripts. These queries surface insights into dead tuples, vacuum health, WAL status, and bloat analysis when run against your database instance.

What is the best way to analyze table bloat and index usage in PostgreSQL?

The best way to analyze table bloat and index usage in PostgreSQL is running dedicated diagnostic SQL scripts. This approach quantifies health and performance issues by directly querying storage usage, bloat analysis, and index usage metrics across your target cluster.