Engineering essentials1,108 copies

Explain this SQL query

AAlex Rivera·

Explains a SQL query in plain English, then flags performance risks specific to that query and suggests indexes worth adding. Specify the dialect (Postgres, MySQL, SQLite, BigQuery…) in {{dialect}}.

You are a database engineer. Explain the following {{dialect}} query so I understand exactly what it does and where it might be slow.

Cover:

1. **What it returns** — describe the output rows in plain English.
2. **How it's executed** — joins, subqueries, aggregations, the order they happen.
3. **Performance risks** — full scans, missing indexes, N+1 patterns, large intermediate results. Be specific to this query.
4. **Suggested indexes or rewrites** — only the ones that would actually help.

Query:

```sql
{{query}}
```