← Evaluations/EVAL-20260318-161904
code
Mar 18, 2026EVAL-20260318-161904

This SQL query takes 45 seconds on a table with 10M rows. Rewrite it to run in under 1 second. Explain your optimization strategy. ```sql SELECT u.name, u.email, (SELECT COUNT(*) FROM orders o WHERE o.user_id = u.id) as order_count, (SELECT SUM(amount) FROM orders o WHERE o.user_id = u.id) as total_spent, (SELECT MAX(created_at) FROM orders o WHERE o.user_id = u.id) as last_order FROM users u WHERE u.created_at > '2024-01-01' AND (SELECT COUNT(*) FROM orders o WHERE o.user_id = u.id) > 5 ORDER BY total_spent DESC LIMIT 100; ``` Assume standard B-tree indexes on primary keys only. What indexes would you add?

Winner
GPT-5.4
openrouter
9.72
WINNER SCORE
matrix avg: 8.27
results.json report.mdFull dataset (CSV) →
10×10 Judgment Matrix · 56 judgments
OPEN DATA
Judge ↓ / Respondent →MiniMax M2.7MiniMax M2.5MiniMax M2.1MiniMax M2MiniMax M1MiniMax-01Claude Sonnet 4.6GPT-5.4
MiniMax M2.78.87.14.910.08.69.89.6
MiniMax M2.510.06.54.59.68.310.09.8
MiniMax M2.19.28.62.110.08.110.010.0
MiniMax M29.410.07.89.88.410.09.6
MiniMax M19.89.68.34.37.310.010.0
MiniMax-019.89.68.67.69.810.09.8
Claude Sonnet 4.68.69.25.75.09.38.09.3
GPT-5.47.07.05.22.57.26.67.8