Re: Parallelized polymorphic aggs, and aggtype vs aggoutputtype

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallelized polymorphic aggs, and aggtype vs aggoutputtype
Date: 2016-06-27 02:01:58
Message-ID: 20160627020158.GA1319154@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 23, 2016 at 10:57:26AM -0400, Tom Lane wrote:
> David Rowley <david(dot)rowley(at)2ndquadrant(dot)com> writes:
> > On 23 June 2016 at 11:22, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> >> The behavior that I'd expect (and that I documented) for a deserialization
> >> function is that it just allocates its result in the current, short-lived
> >> memory context, since it will be the combine function's responsibility to
> >> merge that into the long-lived transition state. But it looks to me like
> >> the deserialization functions in numeric.c are allocating their results
> >> in the aggregate context, which will mean a leak. (For example,
> >> numeric_avg_deserialize creates its result using makeNumericAggState
> >> which forces the result into the agg context.)
>
> > Yes, you're right.
>
> > In the end I decided to add a makeNumericAggStateCurrentContext()
> > function which does not perform any memory context switching at all.
> > It seems like this can be used for the combine functions too, since
> > they've already switched to the aggregate memory context. This should
> > save a few cycles during aggregate combine, and not expend any extra
> > as some alternatives, like adding a flag to makeNumericAggState().
>
> You missed the ones using makePolyNumAggState --- I fixed that and
> pushed it.

What, if anything, is yet required to close this 9.6 open item?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2016-06-27 02:22:26 Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?
Previous Message David Rowley 2016-06-27 01:17:10 Re: Rethinking representation of partial-aggregate steps