Diagnose Slow SQL Queries with EXPLAIN ANALYZE & Composite Index Tuning via AI
Table crossed 1M rows and your API suddenly times out at 8 seconds? Paste your slow SQL query, `SHOW CREATE TABLE` DDL, and `EXPLAIN ANALYZE` output into AI to fix index invalidation, design optimal composite covering indexes, and rewrite slow `LIMIT 100000, 20` deep pagination.
Adding random single-column indexes bloats storage while the optimizer still scans hundreds of thousands of rows. Feeding the schema + EXPLAIN plan to AI produces a surgical composite index that drops 10s queries to 5ms.
Step-by-Step Action Checklist
0 / 4 CompletedAct as a Principal Database Administrator (MySQL 8.0 / PostgreSQL 16). I have a slow query taking [X] seconds on a table with [X] million rows. 1) **Slow SQL**: ```sql [Paste SQL] ``` 2) **Table Schema & Indexes (`SHOW CREATE TABLE`)**: ```sql [Paste DDL] ``` 3) **`EXPLAIN ANALYZE` Output**: ```text [Paste EXPLAIN] ``` Provide: 1) [Execution Plan Breakdown]: Explain why the optimizer chose this plan and why index invalidation, `Using filesort`, or `Using temporary` occurred; 2) [Optimal Composite Index DDL]: Exact `CREATE INDEX` statement following ESR (Equality, Sort, Range) rules, plus redundant existing indexes safe to drop; 3) [High-Performance SQL Rewrite]: Equivalent query using deferred joins, CTEs or `EXISTS` for sub-50ms execution.