I don't like using array and hstore if I know I will need to aggregation on them later, but sometimes you get stuck with a design that has them, or you end up having to run calculations you never thought you would.
Make sure to use a subquery or a CTE or it'll run the sum on the whole table, even if you specified a limit.
Make sure to use a subquery or a CTE or it'll run the sum on the whole table, even if you specified a limit.