postgresql-optimization

Analyze PostgreSQL query execution plans and recommend index strategies.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/diegocondo10/sinai-intranet-backend --skill postgresql-optimization-diegocondo10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-optimization
Source: https://github.com/diegocondo10/sinai-intranet-backend/tree/main/.agents/skills/postgresql-optimization
Command: npx skills add https://github.com/diegocondo10/sinai-intranet-backend --skill postgresql-optimization-diegocondo10

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you diagnose and improve slow PostgreSQL databases by turning query bottlenecks, weak indexing, and inefficient schema choices into clear optimization actions.

Core Features & Use Cases

  • Query Performance Analysis: Review execution patterns, identify expensive scans, and suggest faster rewrites.
  • Index Strategy Guidance: Recommend composite, partial, expression, and covering indexes for common workload shapes.
  • PostgreSQL Feature Optimization: Apply advanced PostgreSQL capabilities such as JSONB operators, array handling, window functions, full-text search, range types, and extensions when they improve performance.
  • Use Case: If an API endpoint is slow because of repeated filters on JSONB fields and large joins, this Skill can recommend the right indexes, query refactors, and maintenance steps to reduce latency.

Quick Start

Ask for a PostgreSQL optimization review of your query, schema, or workload and include the SQL, table sizes, indexes, and performance symptoms you want analyzed.

Frequently Asked Questions about postgresql-optimization

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

FAQPage Schema
How do I optimize slow PostgreSQL queries and reduce database latency?

PostgreSQL query tuning involves reviewing execution plans to find expensive scans, designing targeted indexes like composite or covering indexes, and rewriting queries to minimize resource usage and latency.

What is the best way to index JSONB fields for faster PostgreSQL queries?

The best way to index JSONB fields is using expression or GIN indexes to accelerate repeated filters, which minimizes full-table scans and improves latency for JSON-heavy application backends.

When should I use partial or covering indexes in PostgreSQL?

Use partial or covering indexes in PostgreSQL when specific workload shapes require frequent filtering on subsets of data or need index-only scans to avoid fetching table blocks and reduce latency.

How do I analyze a PostgreSQL execution plan to fix slow queries?

Analyzing a PostgreSQL execution plan involves identifying expensive sequential scans or costly joins, then applying query refactors and index designs to reduce overall database resource usage.

What PostgreSQL performance maintenance steps prevent query degradation over time?

PostgreSQL performance maintenance involves regular execution-plan analysis and index strategy adjustments to sustain query speed and scale as application backends and analytics workloads evolve.

Does PostgreSQL query tuning work for analytics workloads with large joins?

PostgreSQL query tuning effectively optimizes analytics workloads by reviewing execution patterns, refactoring large joins, and recommending covering indexes to reduce resource usage and latency.