hard
Advanced SQL Query Optimization
Analyze and optimize a slow SQL query.
📝 Contenuto del prompt
Analyze the following hypothetical slow SQL query involving multiple joins and subqueries. Explain the execution plan, identify bottlenecks, and rewrite the query to optimize performance for a PostgreSQL database with 10 million rows. Provide the optimized SQL and an explanation of the indexing strategy required.