Comment

Nico Latzer

have the same assumption, dividing into 2 sets might yield better results (select count,sum from yesterday UNION ALL select ... from today). Are exact values needed? then you could get rid of aggregating kbytes

Parent comment

Chris

I wonder if the lack of fields in the main query and only fields in subqueries is producing a suboptimal optimization. Does anything change if you add a where upload.created_at > start_of_year to the outer select?