Advanced
Query Plan Analysis and Rewriting
Analyze and optimize a complex SQL query execution plan.
📝 Prompt-Inhalt
Analyze a hypothetical SQL execution plan for a query involving five table joins, subqueries, and window functions. Identify specific bottlenecks such as full table scans, hash spills, or expensive sorts. Rewrite the query to improve performance by applying index optimization, join reordering, or materialized view strategies. Explain the reasoning behind every change you make to the query structure.