Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    Postgres Query Optimizer: Find & Prove the Fix

    1

    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.

    $15

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned
    Postgres Query Optimizer: Find & Prove the Fix

    Postgres Query Optimizer: Find & Prove the Fix

    Example session with this skill installed

    On the connected staging database, optimize SELECT * FROM orders WHERE customer_id = 842 AND status = 'pending'. You may test fixes and roll them back. Give me the SQL worth applying.

    • Read your context and instructions
    • Compiled the postgres query optimizer
    • Generated the document

    The query's median execution time fell from

    240 ms to 36 ms, an

    85% reduction, with a composite index in staging.
    Test changes were rolled back. No index was kept.

    Findings and tested fixes

    The main bottleneck was a full scan of orders, discarding 1,199,976 rows to return 24. No existing index covered both filter columns.

    TestMedian timeResult
    Original query240 msBaseline
    Index on customer_id and status36 msVerified improvement
    Statistics refresh alone236 msNo meaningful improvement

    The indexed plan used a bitmap index scan followed by a bitmap heap scan instead of reading the entire table.

    SQL worth applying

    For production, build the index concurrently to avoid blocking normal writes during the build. Run this outside a transaction block:

    CREATE INDEX CONCURRENTLY idx_orders_customer_status
    ON orders (customer_id, status);
    
    ANALYZE orders;
    

    The index consumes disk space and adds work to inserts and updates. This test did not measure that write overhead. Staging results may differ from production.

    Detailed plan timings and test comparisons are in pgopt-output/report.md.

    Next steps

    • Confirm staging data volume is representative of production.
    • Apply the index during an appropriate deployment window.
    • Recheck query timing and write performance after deployment.

    postgres-query-optimizer-find-prove-the-.pdf

    PDF · document

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    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 install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    • Passed all security checks, Safe to install

    Listedtoday

    What's inside

    Frequently Asked Questions