← Evaluations/EVAL-20260402-131651
code
Apr 02, 2026CODE-013

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
Claude Opus 4.6
openrouter
9.29
WINNER SCORE
matrix avg: 7.68
results.json report.mdFull dataset (CSV) →
10×10 Judgment Matrix · 54 judgments
OPEN DATA
Judge ↓ / Respondent →GPT-5.4Gemini 3Claude Opus 4.6Gemini 3.1 ProClaude Sonnet 4.6MiniMax M2.5Grok 4.20GPT-OSS-120BMiMo-V2-FlashDeepSeek V4
GPT-5.47.88.60.58.4··7.87.44.7
Gemini 39.810.01.410.0··9.89.68.0
Claude Opus 4.69.68.61.09.2··9.28.96.5
Gemini 3.1 Pro7.28.09.69.6··7.86.37.7
Claude Sonnet 4.69.38.89.61.0··9.69.27.2
MiniMax M2.59.28.69.01.09.0·8.89.27.8
Grok 4.209.0·9.00.28.8····
GPT-OSS-120B·8.6·····8.6·
MiMo-V2-Flash9.39.39.32.5····7.8
DeepSeek V4·········