Expert
SQL Query Performance Optimizer
Reviews complex SQL queries for performance bottlenecks and suggests execution plan improvements.
📝 Promptens innehåll
Review the provided SQL query. Assume a standard relational database schema with millions of rows in the referenced tables. Analyze the query for potential full table scans, inefficient joins, and suboptimal use of CTEs or subqueries. Rewrite the query to optimize performance. Provide a line-by-line explanation of why your changes improve the execution plan, suggesting specific indexes that would further boost performance.