Re: [GENERAL] The fastes way to sum array of integers

2012-12-16 Thread Pavel Stehule
2012/12/16 aasat : > Hi, > > I sum values of array integers by query > > select sum(t) > from unnest(array[1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]) as t > cross join generate_series(1, 100); > > Total runtime: 10020.699 ms > > But simmilar method to count array's elements is dramatic

[GENERAL] The fastes way to sum array of integers

2012-12-16 Thread aasat
Hi, I sum values of array integers by query select sum(t) from unnest(array[1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0]) as t cross join generate_series(1, 100); Total runtime: 10020.699 ms But simmilar method to count array's elements is dramatically faster select sum(array_length(