← Evaluations/EVAL-20260315-034158
code
Mar 15, 2026EVAL-20260315-034158

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
Qwen 3 32B
openrouter
9.66
WINNER SCORE
matrix avg: 8.70
results.json report.mdFull dataset (CSV) →
10×10 Judgment Matrix · 76 judgments
OPEN DATA
Judge ↓ / Respondent →Qwen 3 32BKimi K2.5Devstral SmallGemma 3 27BLlama 4 ScoutPhi-4 14BGranite 4.0 MicroQwen 3 8BMistral Nemo 12BLlama 3.1 8B
Qwen 3 32B·7.89.28.08.49.09.68.68.0
Kimi K2.5····6.2···4.0
Devstral Small10.0·10.08.69.69.810.09.68.6
Gemma 3 27B9.81.09.68.99.48.99.89.88.4
Llama 4 Scout9.8·9.69.88.88.89.89.68.4
Phi-4 14B9.88.29.810.08.68.810.09.89.2
Granite 4.0 Micro8.87.58.88.88.48.88.88.88.8
Qwen 3 8B9.4·9.49.49.29.48.88.68.7
Mistral Nemo 12B10.0·8.19.89.67.78.3·9.1
Llama 3.1 8B9.6·9.29.69.18.68.89.68.6