Sql Query Optimizer

    1

    Expert-level SQL tuning and performance auditing for PostgreSQL, MySQL, SQLite, and SQL Server.

    Secure checkout via Stripe

    0 installsSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLIVVS CodeWWindsurfMManus+14 more

    See it in action

    You say

    This analytical query on our 500k row orders table is taking 30 seconds. Can you optimize it and suggest any missing indexes? SELECT * FROM orders WHERE EXTRACT(YEAR FROM created_at) = 2024;

    Your agent does

    I've rewritten the query to use a sargable range scan: `SELECT id, customer_id, total FROM orders WHERE created_at >= '2024-01-01' AND created_at < '2025-01-01';` Recommendation: Create an index on `created_at`. This changes a full Table Scan (500k rows) to an Index Range Scan (~12k rows).

    What you get

    Reduce query latency by identifying and fixing non-sargable WHERE clauses.Convert slow OFFSET-based pagination to high-performance keyset pagination.Eliminate N+1 query patterns in application code through efficient JOINs.Interpret EXPLAIN plans to fix full table scans in production environments.

    About this skill

    What it does

    This skill transforms your AI agent into a senior database performance engineer. It provides a systematic methodology for diagnosing slow SQL queries, interpreting complex execution plans, and rewriting code for maximum efficiency across PostgreSQL, MySQL, SQLite, and SQL Server.

    Why use this skill

    Standard LLMs often suggest generic SQL adjustments that might not actually trigger index usage or could even degrade write performance. This skill implements a developer-centric workflow: it demands EXPLAIN plans, identifies specific anti-patterns like non-sargable predicates and N+1 loops, and provides concrete before/after benchmarks. It ensures your agent understands dialect-specific nuances, such as how MySQL handles implicit type casts versus PostgreSQL's CTE materialization strategies.

    Key Features

    • Execution Plan Analysis: Deep interpretation of EXPLAIN ANALYZE and SCAN TABLE outputs.
    • Index Strategy: Recommendations for composite and covering indexes based on read-to-write ratios.
    • Query Refactoring: Converting slow correlated subqueries into efficient joins and implementing keyset pagination.
    • Anti-Pattern Detection: Automatic flagging of 'SELECT *', wildcard prefixes, and improper NULL handling.

    The Output

    The agent delivers a structured performance report including the optimized SQL, the specific reasoning for each change, detailed index recommendations, and an estimated performance delta (e.g., Seq Scan to Index Scan transition).

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    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 1 month ago

    Listed1 month ago
    Updated10 days ago

    Frequently Asked Questions