# Postgres Query Optimizer: Find & Prove the Fix

> Runs EXPLAIN ANALYZE safely, pinpoints exactly why your Postgres query is slow, and tests every fix in a rolled-back transaction. Verified 375–2,347× speedups.

Postgres Query Optimizer: Find & Prove the Fix is a paid AI agent skill on Agensi by Warpstep, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Warpstep](https://www.agensi.io/creators/warpstep)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.1
- Last updated: 2026-10-05
- Security: scan passed (2026-10-05); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/postgres-query-optimizer-find-prove-the-fix
- Tags: database, postgresql, query-optimization, execution-plans, index-tuning

## About this skill

A slow database query can hold up an entire page or endpoint. Find where PostgreSQL spends its time, get specific fixes, and test whether they actually help before keeping them.

### What it does

- **Explains the bottleneck:** Reads the query execution plan to identify expensive scans, joins, sorts, and other slow steps.
- **Suggests targeted fixes:** Recommends relevant indexes, statistics updates, or memory settings rather than guessing from SQL alone.
- **Tests improvements:** With database access and permission, compares timings and rolls back the test changes.
- **Reports what failed:** Shows tested fixes that did not help, alongside the exact SQL for useful changes.

### How it works

1. Share a slow query with database access, or paste a PostgreSQL execution plan.
2. Get a breakdown of the costly steps and suggested fixes.
3. Approve live testing if you want measured comparisons.
4. Review the report and choose which changes to apply.

### Works with

PostgreSQL, including Supabase, Neon, Amazon RDS, and Cloud SQL. Running the tool requires Python 3 and the PostgreSQL `psql` client. Offline analysis works from a JSON execution plan.

### Why use this skill

Avoid spending time adding indexes that do not address the bottleneck. Measured comparisons help you separate useful changes from ones that only sound promising.

### Use cases

- Diagnose a slow customer dashboard query.
- Check whether a proposed index improves an endpoint.
- Review a query plan without sharing database access.

### Known limitations

Handles one query at a time. Test timings depend on the environment. Index tests can block writes, so production testing needs care.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Postgres Query Optimizer: Find & Prove the Fix skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does the pg query optimizer differ from a standard SQL linter?

The skill analyzes PostgreSQL execution plans to identify specific bottlenecks like sequential scans or inefficient joins, then suggests and tests optimizations—such as new indexes or rewritten SQL—to verify actual performance gains.

### Can I use this skill if I don't want to grant the AI access to my live database?

Yes, you can paste a JSON execution plan for offline analysis without providing direct database access. However, live features like automated performance testing and rollback require a connection to your PostgreSQL instance.

### Which PostgreSQL platforms and versions are supported?

It is compatible with any PostgreSQL environment, including managed services like Supabase, Neon, AWS RDS, and Google Cloud SQL, provided your environment has Python 3 and the psql client installed.

### Are there any risks to running performance tests on a production database?

When testing index changes, the skill can briefly lock tables, which may impact write operations. We recommend running automated tests in a staging environment or during low-traffic windows to ensure production stability.

### What exactly is included with my purchase of this skill?

You receive the full AI agent skill, including the logic for plan analysis, a suite of optimization strategies, and the automated testing/rollback scripts for measured verification.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
