Level 7 - ArchitectQuery-Based Questionsm2 query shape optimization
Pre-Aggregate Before Joining Large Dimensions
Return each customer total_spend and loyalty_tier for last 90 days. Keep query shape efficient.
Schema Context
orders(order_id, customer_id, total_amount, order_date), customers(customer_id, loyalty_tier)