In my case we have only one query to db - but after this query we don't have to iterate through result and sum values but db returns sum of values and we dont have to do this on python site