News for hackers. Stuff that matters.
Re:Postgres Performance: To avg or To sum/count by teoryn on Thursday November 15, 2012 @11:23AM (#4789256)
The faster version looks like it might not be numerically stable; if sum(l_quantity) is greater than the maximum value that can be represented it would overflow and give meaningless results. Given the arrays mentioned by the average function, it could also be maintaining a heap and adding the numbers from smallest to largest for more stability.
Re:Postgres Performance: To avg or To sum/count by Someone on Thursday November 15, 2012 @12:54PM (#4789792)
According to the post, it does not. That array has two elements:

"the numeric average function uses an array of two numerics to keep track of the current sum and count."