Drop in your before-and-after. Get a verdict in seconds.
Replace SUM(CASE WHEN x > 0 THEN x ELSE 0) with SUM(GREATEST(x, 0)).