SELECT user_id, SUM(amount) AS total_spend
FROM orders
WHERE created_at >= '2026-01-01' AND created_at < '2027-01-01'
GROUP BY user_id
ORDER BY total_spend DESC
LIMIT 5;
This filters orders to 2026 using a half-open range (which keeps the query sargable on an index over created_at), aggregates spend per user, and returns the top 5.