Re: Rethinking representation of partial-aggregate steps

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(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: Rethinking representation of partial-aggregate steps
Date: 2016-06-24 01:53:54
Message-ID: CAKJS1f-vriv6hm7oCBXb+NyifwnrGYybVPZtiMwKRdFoECZbuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24 June 2016 at 05:55, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> #define AGGOP_COMBINESTATES 0x1
> #define AGGOP_SERIALIZESTATES 0x2
> #define AGGOP_DESERIALIZESTATES 0x4
> #define AGGOP_FINALIZEAGGS 0x8
>
> typedef enum AggPartialMode
> {
> AGGPARTIAL_SIMPLE = AGGOP_FINALIZEAGGS,
> AGGPARTIAL_PARTIAL = AGGOP_SERIALIZESTATES,
> AGGPARTIAL_FINAL = AGGOP_COMBINESTATES | AGGOP_DESERIALIZESTATES | AGGOP_FINALIZEAGGS
> } AggPartialMode;
>
> #define DO_AGGPARTIAL_COMBINE(apm) (((apm) & AGGOP_COMBINESTATES) != 0)
> #define DO_AGGPARTIAL_SERIALIZE(apm) (((apm) & AGGOP_SERIALIZESTATES) != 0)
> #define DO_AGGPARTIAL_DESERIALIZE(apm) (((apm) & AGGOP_DESERIALIZESTATES) != 0)
> #define DO_AGGPARTIAL_FINALIZE(apm) (((apm) & AGGOP_FINALIZEAGGS) != 0)

The attached implements this, with the exception that I didn't really
think AggPartialMode was the best name for the enum. I've named this
AggregateMode instead, as the aggregate is only partial in some cases.
I also appended _SERIAL and _DESERIAL to the end of the partial and
final modes for now, as likely in 10.0 we'll be performing some
partial non-serialized aggregation and we'll likely want to keep those
other names for that instead.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
aggmode_bitflags.patch application/octet-stream 23.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2016-06-24 02:04:22 Re: Reviewing freeze map code
Previous Message Tsunakawa, Takayuki 2016-06-24 00:45:41 Re: Feature suggestions: "dead letter"-savepoint.