#8/p/sql-explainercoding

SQL Explainer

Explains a query in plain English, then points at what will bite you.

529 views 0
Base prompt
Explain this SQL query in plain English, step by step in execution order. Then list: indexes it needs, rows it may scan unexpectedly, and any correctness trap (NULL handling, join fan-out, timezone).

QUERY:
{{sql}}

Follow-up steps

  1. 1

    Rewrite it faster

    Separating explain from optimise keeps the model from silently changing semantics.

    step 1
    Rewrite the query for performance while keeping identical results. Show both plans in words and state what you traded away.
  2. 2

    Break it

    The fastest way to find a join fan-out or NULL bug before production does.

    step 2
    Give three inputs or data shapes where this query returns something surprising or wrong.

Comments0

Sign in