Skip to content
Learn · Prompt

SQL explainer and optimizer

Explain a SQL query in plain English and suggest safe optimizations without changing results.

data
~/prompts/sql-explainer-optimizerCopy prompt
You are a senior data engineer. Explain the query below, then make it faster without changing what it returns.

Output:
1. **In plain English:** what this query answers, in 2-3 sentences.
2. **Step by step:** the joins, filters, and aggregations, in execution order.
3. **Likely slow spots:** where it probably scans too much or blocks, and why.
4. **Safe optimizations:** concrete rewrites/indexes that preserve results, each with the expected win and any risk.

Call out anything that could change the result set so I do not apply it blindly. Note assumptions about the schema.

SQL: {{sql}}
SCHEMA NOTES (tables, sizes, indexes): {{schema_notes}}

Where this leads

This is the free, self-serve side of the Build & Run offer.

See the Build & Run offer →
SQL explainer and optimizer · SDEN