Re: [HACKERS] Optimizing aggregates

2016-08-31 Thread Andres Freund
On 2016-08-31 19:07:00 +0300, Heikki Linnakangas wrote: > On 08/31/2016 06:51 PM, Andres Freund wrote: > > I've first combined the projection for all the aggregates, ordered set, > > or not, into one projetion. That got rid of a fair amount of overhead > > when you have multiple aggregates. I

Re: [HACKERS] Optimizing aggregates

2016-08-31 Thread Heikki Linnakangas
On 08/31/2016 06:51 PM, Andres Freund wrote: On 2016-08-31 17:47:18 +0300, Heikki Linnakangas wrote: We actually used to call ExecEvalExpr() directly for each argument, but that was changed by the patch that added support for ordered set aggregates. It looks like that was a bad idea, from a

Re: [HACKERS] Optimizing aggregates

2016-08-31 Thread Andres Freund
Hi, On 2016-08-31 17:47:18 +0300, Heikki Linnakangas wrote: > # .. . > > # > 25.70% 0.00% postmaster [unknown] [k] > 14.23%13.75% postmaster postgres [.]

[HACKERS] Optimizing aggregates

2016-08-31 Thread Heikki Linnakangas
I've been profiling simple aggregate queries, looking for any low-hanging fruit. For this query: -- setup create table floats as select g::float8 as a, g::float8 as b, g::float8 as c from generate_series(1, 1000) g; vacuum freeze floats; -- query select sum(a), sum(b+c) from floats;