AI/AIZENME
⚡ CODING · Dev & Data Level: Intermediate ⏱ 10 MIN Free & Open Source

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.

CORE TOOLS MySQL / PostgreSQL, EXPLAIN ANALYZE, DeepSeek / Claude
BEST FOR Backend engineers, DBAs, full-stack developers, system architects
REQUIREMENTS Slow SQL query, table DDL and EXPLAIN output
✦ WHY THIS WORKFLOW

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.

✦ Interactive Workflow Animation Preview

Step-by-Step Action Checklist

0 / 4 Completed
READY-TO-USE PROMPT TEMPLATE
Open Official Tool / Repo ↗
Act 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.
Use Cases & Tags:
Fixing silent index invalidation from functions or implicit type castsDesigning composite covering indexes to eliminate filesort & table lookupsRewriting slow OFFSET deep pagination into deferred joins or keyset cursorsFixing collation mismatch full-table scans in JOINsFixing silent index invalidation from functions or implicit type casts