Re: Parallel Aggregate

From: James Sewell <james(dot)sewell(at)lisasoft(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel Aggregate
Date: 2016-03-17 03:13:14
Message-ID: CANkGpBvPQUoGi6WPj6mxHOx3c0PcYNM-AoiOaPa=Penb7758pg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi again,

This is probably me missing something, but is there a reason parallel
aggregate doesn't seem to ever create append nodes containing Index scans?

SET random_page_cost TO 0.2;
SET max_parallel_degree TO 8;

postgres=# explain SELECT sum(count_i) FROM base GROUP BY view_time_day;
QUERY PLAN
-------------------------------------------------------------------------------------------------
Finalize GroupAggregate (cost=310596.32..310598.03 rows=31 width=16)
Group Key: view_time_day
-> Sort (cost=310596.32..310596.79 rows=186 width=16)
Sort Key: view_time_day
-> Gather (cost=310589.00..310589.31 rows=186 width=16)
Number of Workers: 5
-> Partial HashAggregate (cost=310589.00..310589.31
rows=31 width=16)
Group Key: view_time_day
-> Parallel Seq Scan on base (cost=0.00..280589.00
rows=6000000 width=12)

SET max_parallel_degree TO 0;

postgres=# explain SELECT sum(count_i) FROM base GROUP BY view_time_day;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------
GroupAggregate (cost=0.56..600085.92 rows=31 width=16)
Group Key: view_time_day
-> Index Only Scan using base_view_time_day_count_i_idx on base
(cost=0.56..450085.61 rows=30000000 width=12)
(3 rows)

Cheers,

James Sewell,
Solutions Architect
______________________________________

Level 2, 50 Queen St, Melbourne VIC 3000

*P *(+61) 3 8370 8000 *W* www.lisasoft.com *F *(+61) 3 8370 8099

On Thu, Mar 17, 2016 at 8:08 AM, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
wrote:

> On 17 March 2016 at 01:29, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> > On Wed, Mar 16, 2016 at 8:19 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
> >> Isn't it better to call it as Parallel Aggregate instead of Partial
> >> Aggregate. Initialy, we have kept Partial for seqscan, but later on we
> >> changed to Parallel Seq Scan, so I am not able to think why it is
> better to
> >> call Partial incase of Aggregates.
> >
> > I think partial is the right terminology. Unlike a parallel
> > sequential scan, a partial aggregate isn't parallel-aware and could be
> > used in contexts having nothing to do with parallelism. It's just
> > that it outputs transition values instead of a finalized value.
>
> +1 the reason the partial aggregate patches have been kept separate
> from the parallel aggregate patches is that partial aggregate will
> serve for many other purposes. Parallel Aggregate is just one of many
> possible use cases for this, so it makes little sense to give it a
> name according to a single use case.
>
> --
> David Rowley http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

--

------------------------------
The contents of this email are confidential and may be subject to legal or
professional privilege and copyright. No representation is made that this
email is free of viruses or other defects. If you have received this
communication in error, you may not copy or distribute any part of it or
otherwise disclose its contents to anyone. Please advise the sender of your
incorrect receipt of this correspondence.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vitaly Burovoy 2016-03-17 03:27:25 Re: [PATCH] Supporting +-Infinity values by to_timestamp(float8)
Previous Message David Rowley 2016-03-17 03:10:58 Re: Parallel Aggregate