I tried a lot but can´t find the right way. If I select values in Postgres and sum them it looks like this:
SELECT name,sum(size) as total FROM mytable group
Well this should help you:
select sum(innerselect.innertotal) as outertotal from (select sum(size) as innertotal from mytable group by name) as innerselect