postgres_pro

Optimizes PostgreSQL queries, indexes, replication, and maintenance using EXPLAIN ANALYZE and pg_stat views.

Updated Jan 14, 2026
One-click install
npx skills add https://github.com/jvsandhu/agentic-skills --skill postgres-pro-jvsandhu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres_pro
Source: https://github.com/jvsandhu/agentic-skills/tree/main/skills/postgres_pro
Command: npx skills add https://github.com/jvsandhu/agentic-skills --skill postgres-pro-jvsandhu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Slow queries, missing indexes, bloated tables, and fragile replication setups degrade PostgreSQL databases in production. This Skill provides senior-DBA-level guidance for diagnosing performance issues, designing indexes, configuring replication, and maintaining database health. ## Core Features & Use Cases - Query Optimization: Analyze slow queries with EXPLAIN (ANALYZE, BUFFERS) and pg_stat_statements, then rewrite queries and design B-tree, GIN, GiST, or BRIN indexes. - Replication & High Availability: Set up streaming or logical replication with failover and lag monitoring. - JSONB & Extensions: Implement JSONB storage with GIN indexing and configure extensions like PostGIS, pgvector, pg_trgm, and pg_stat_statements. - Use Case: A dashboard query takes 30 seconds. Use this Skill to run EXPLAIN ANALYZE, identify a sequential scan, add the right index, tune autovacuum, and verify the improvement with before/after metrics. ## Quick Start Ask the agent to analyze a slow PostgreSQL query with EXPLAIN ANALYZE and recommend indexes and configuration changes.

Frequently Asked Questions about postgres_pro

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

FAQPage Schema
How do I optimize a slow PostgreSQL query?

Run EXPLAIN (ANALYZE, BUFFERS) to see the real cost and I/O of the query, then check for sequential scans on large tables. Add an appropriate index (B-tree, GIN, GiST, or BRIN) and refresh statistics with ANALYZE after bulk changes.

Which PostgreSQL index type should I use for JSONB columns?

Use a GIN index for JSONB columns, since it supports containment and key-existence operators efficiently. B-tree indexes only help for equality on the whole document, while GiST suits range or geometric data.

What is the difference between streaming and logical replication in PostgreSQL?

Streaming replication copies the entire cluster at the WAL level for high availability and read replicas. Logical replication replicates selected tables at the row level, enabling cross-version upgrades and selective data distribution.

Does PostgreSQL support vector search for AI applications?

Yes, the pgvector extension adds vector storage and similarity search to PostgreSQL. Install the extension and configure HNSW indexes for efficient approximate nearest-neighbor queries in AI and ML workloads.

Why is my PostgreSQL table growing despite deleting rows?

Deleted rows leave dead tuples that only VACUUM reclaims, so table bloat occurs when autovacuum cannot keep up with churn. Tune autovacuum_vacuum_scale_factor per table and monitor bloat with pg_stat_user_tables.

When should I not disable autovacuum in PostgreSQL?

Never disable autovacuum globally, since it prevents transaction ID wraparound and controls bloat. Instead, tune its settings per table or schedule manual VACUUM jobs for high-churn tables during off-peak hours.