Level 7 - ArchitectDebugging Questionsm2 query shape optimization
Debug Correlated Subquery Re-Execution Cost
Rewrite this expensive pattern: SELECT c.customer_id, (SELECT SUM(o.total_amount) FROM orders o WHERE o.customer_id = c.customer_id) AS spend FROM customers c;
Schema Context
customers(customer_id), orders(order_id, customer_id, total_amount)