From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: Speed of user-defined aggregates using array_append as transfn |
Date: | 2016-10-28 20:34:57 |
Message-ID: | 18705.1477686897@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> 3. We could try to fix it mostly from array_append's side, by teaching it
> to return the expanded array in the aggregation context when it's being
> called as an aggregate function, and making some
> hopefully-not-performance-killing tweaks to nodeAgg to play along with
> that. This would amount to additional complication in the API contract
> for C-coded aggregate functions, but I think it wouldn't affect functions
> that weren't attempting to invoke the optimization, so it should be OK.
> A larger objection is that it still doesn't do anything for the memory
> consumption angle.
Hm, that actually seems to work, at least from a speed standpoint; see
the attached not-terribly-well-documented patch. The additions to nodeAgg
are only in places where we're going to be doing datum copying or freeing
anyway.
I'm still worried about chewing up a kilobyte-at-least for each transition
value, but maybe that's something we could leave to fix later. Another
idea is that we could teach the planner to know about that in its hash
table size estimates.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
allow-expanded-aggregate-transvalues-2.patch | text/x-diff | 6.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2016-10-28 21:17:36 | Re: emergency outage requiring database restart |
Previous Message | Jim Nasby | 2016-10-28 20:16:05 | Re: emergency outage requiring database restart |