Is using SUM() twice suboptimal?
The sum is only computed once.

I verified this using

create table mytable (id int, hours int);
insert into mytable values (1, 60);
select sum(hours) from mytable group by id having sum(hours) &gt; 50;


and then used a debugger to check how many times int4_sum (the transition function behind the sum aggregate) was called: once.